Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Diagnostics.Tracing;
- namespace КоледнаШапка
- {
- class Program
- {
- static void Main(string[] args)
- {
- var w = int.Parse(Console.ReadLine());
- var l = int.Parse(Console.ReadLine());
- var pieces = w * l;
- var piecesCount = 0;
- for (int i = 1; i <= 1000; i++)
- {
- try
- {
- var piecesEat = int.Parse(Console.ReadLine());
- piecesCount = piecesCount + piecesEat;
- }
- catch
- {
- break;
- }
- }
- var diff = pieces - piecesCount;
- if (diff >= 0)
- {
- Console.WriteLine($"{diff} pieces are left.");
- }
- else
- {
- diff = Math.Abs(diff);
- Console.WriteLine($"No more cake left! You need {diff} pieces more.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment