Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Program
- {
- public static void Main()
- {
- int kg = int.Parse(Console.ReadLine());
- int days = int.Parse(Console.ReadLine());
- int allgr = 0;
- for (int i = 1; i <= days; i++)
- {
- int gr = int.Parse(Console.ReadLine());
- allgr += gr;
- }
- int g = kg * 1000;
- if(g >= allgr)
- {
- Console.WriteLine("Food is enough! Leftovers: {0} grams.", g - allgr );
- }
- else
- {
- Console.WriteLine("Food is not enough. You need {0} grams more.", allgr - g);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement