Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- public class Program
- {
- public static void Main()
- {
- int capacity = 255;
- int n = int.Parse(Console.ReadLine());
- int poured = 0;
- for (int i=0; i<n; i++)
- {
- int currQuantity = int.Parse(Console.ReadLine());
- if (currQuantity + poured > capacity)
- {
- Console.WriteLine("Insufficient capacity!");
- continue;
- }
- else
- {
- poured += currQuantity;
- }
- }
- Console.WriteLine(poured);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment