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