Advertisement
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 ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> results = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
- List<int> initialResults = results.ToList();
- int brizpitvaniq = int.Parse(Console.ReadLine());
- bool broken = false;
- for (int i = 1; i <= brizpitvaniq; i++)
- {
- int[] marks = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
- int studentNum = marks[0];
- int result = marks[1];
- if(results.Count==0)
- {
- Console.WriteLine("All studets has been expelled due bad results!");
- broken = true;
- break;
- }
- if (result < results[studentNum])
- {
- results[studentNum] = results[studentNum] - result;
- }
- else if (result > results[studentNum])
- {
- results[studentNum] = results[studentNum] + result;
- }
- if (results[studentNum]*2<initialResults[studentNum])
- {
- results.Remove(results[studentNum]);
- initialResults.Remove(initialResults[studentNum]);
- }
- }
- if (broken == false)
- {
- Console.WriteLine(string.Join("; ", results));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement