Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- class MelonsAndWatermelons
- {
- static void Main()
- {
- int s = int.Parse(Console.ReadLine());
- int d = int.Parse(Console.ReadLine());
- int watermelons = 0;
- int melons = 0;
- for (int i = 0; i < d; i++)
- {
- watermelons += Watemelons(s);
- melons += Melons(s);
- s++;
- if (s == 8)
- {
- s = 1;
- }
- }
- if (watermelons == melons)
- {
- Console.WriteLine("Equal amount: {0}", watermelons);
- }
- else if (watermelons > melons)
- {
- Console.WriteLine("{0} more watermelons", watermelons - melons);
- }
- else
- {
- Console.WriteLine("{0} more melons", melons - watermelons );
- }
- }
- public static int Melons(int day)
- {
- int melons = 0;
- switch (day)
- {
- case 2:
- case 5:
- case 6:
- melons += 2; break;
- case 3:
- melons++; break;
- }
- return melons;
- }
- public static int Watemelons (int day)
- {
- int watermelons = 0;
- switch (day)
- {
- case 1:
- case 3:
- case 6:
- watermelons++; break;
- case 4:
- case 5:
- watermelons += 2; break;
- }
- return watermelons;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement