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 _03_water_overflow
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int litresFilled = 0;
- for (int i = 0; i < n; i++)
- {
- int fillWith = int.Parse(Console.ReadLine());
- if (fillWith > 255 - litresFilled)
- {
- Console.WriteLine("Insufficient capacity!");
- }
- if (fillWith <= 255 - litresFilled)
- {
- litresFilled += fillWith;
- }
- }
- Console.WriteLine(litresFilled);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment