Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace exampreparation
- {
- class exam
- {
- static void Main(string[] args)
- {
- int times = int.Parse(Console.ReadLine());
- int sumwater = 0;
- int capacity = 255;
- for (int i = 0; i < times; i++)
- {
- int water = int.Parse(Console.ReadLine());
- capacity -= water;
- if (capacity < 0 )
- {
- Console.WriteLine("Insufficient capacity!");
- capacity += water;
- }
- else
- {
- sumwater += water;
- }
- }
- Console.WriteLine(sumwater);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement