Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace PowerPlants_6
- {
- public class PowerPlants_6
- {
- public static void Main(string[] args)
- {
- var powerLevel = Console.ReadLine()
- .Split(' ')
- .Select(int.Parse)
- .ToArray();
- var daysInSeason = powerLevel.Length;
- var daysAlive = 0;
- for (int i = 0; i < daysInSeason-1; i++)
- {
- for (int p = 0; p < powerLevel.Length; p++)
- {
- if (i!=p && powerLevel[p]!=0)
- {
- powerLevel[p] = powerLevel[p] - 1;
- }
- }
- daysAlive++;
- }
- Console.WriteLine(daysAlive);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment