Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Net.Sockets;
- using System.Net.Http;
- using System.Threading.Tasks;
- using System.IO;
- using System.Linq;
- namespace Test
- {
- public class Program
- {
- public static void Main()
- {
- int n = int.Parse(Console.ReadLine()); // 5;
- int maxCapacity = 255; // This is the capacity of tank;
- int capacity = 0;
- for(int i = 0; i < n; i ++)
- {
- int currentCapacity = int.Parse(Console.ReadLine()); // Litres of water we get everytime
- if(capacity + currentCapacity <= maxCapacity)
- {
- capacity += currentCapacity;
- }
- else
- {
- Console.WriteLine("Insufficient capacity!");
- continue;
- }
- }
- Console.WriteLine(capacity);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement