Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Cake
- {
- class Program
- {
- static void Main(string[] args)
- {
- int x = int.Parse(Console.ReadLine());
- int y = int.Parse(Console.ReadLine());
- int pieceOfCake = x * y;
- int hungry = 0;
- while (pieceOfCake >= hungry)
- {
- string command = Console.ReadLine();
- if (command == "STOP")
- {
- break;
- }
- hungry += int.Parse(command);
- }
- if (pieceOfCake >= hungry)
- {
- Console.WriteLine($"{pieceOfCake - hungry} pieces are left.");
- }
- else
- {
- Console.WriteLine($"No more cake left! You need {hungry - pieceOfCake} pieces more.");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment