Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Spyfer
- {
- class Spyfer
- {
- static void Main(string[] args)
- {
- List<int> input = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
- Outer:
- for (int i = 1; i < input.Count-1; i++)
- {
- if (input[i] == input[i - 1] + input[i + 1])
- {
- input.RemoveAt(i - 1);
- input.RemoveAt(i);
- goto Outer;
- }
- }
- for (int i = 0; i < input.Count - 1; i++)
- {
- if (input[i] == input[i + 1])
- {
- input.RemoveAt(i + 1);
- goto Outer;
- }
- }
- Console.WriteLine(string.Join(" ", input));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment