Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.IO;
- using System.Text;
- using System.Collections;
- using System.Collections.Generic;
- /**
- * Auto-generated code below aims at helping you parse
- * the standard input according to the problem statement.
- **/
- class Solution
- {
- static void Main(string[] args)
- {
- int N = int.Parse(Console.ReadLine());
- int Y = int.Parse(Console.ReadLine());
- // 0:
- // row represents cages
- long[,] data = new long[N, 3];
- for (int i = 0; i < N; i++)
- {
- string[] inputs = Console.ReadLine().Split(' ');
- long S = long.Parse(inputs[0]);
- long H = long.Parse(inputs[1]);
- long A = long.Parse(inputs[2]);
- data[i, 0] = S;
- data[i, 1] = H;
- data[i, 2] = A; // = S + H
- }
- // Console.Error.WriteLine("total: + " + data.GetLength(0));
- // Console.Error.WriteLine("year: + " + Y);
- for (int i = 0; i < Y; i++)
- {
- long total = 0;
- for (int j = 0; j < N; j++)
- {
- // s=sick, h=healthy, a=alive (a = s+h)
- data[j, 2] -= data[j, 0];
- data[j, 0] = data[j, 0] * 2;
- data[j, 1] -= data[j, 0];
- total += data[j, 2] > 0 ? data[j, 2] : 0;
- }
- Console.WriteLine(total);
- if (total == 0)
- {
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement