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 startingDay = int.Parse(Console.ReadLine());
- int numberOfDays = int.Parse(Console.ReadLine());
- int countOfMelons = 0;
- int countOfWatermelons = 0;
- string[] days = { "mon", "tue", "wed", "thur", "fri", "sat", "sun" };
- for (int i = 0; i < numberOfDays; i++)
- {
- int dayOfWeek = startingDay - 1 + i;
- if (dayOfWeek >= 7)
- {
- dayOfWeek = dayOfWeek % 7;
- }
- string currentDay = days[dayOfWeek];
- switch (currentDay)
- {
- case "mon":
- countOfWatermelons++;
- break;
- case "tue":
- countOfMelons += 2;
- break;
- case "wed":
- countOfMelons++;
- countOfWatermelons++;
- break;
- case "thur":
- countOfWatermelons += 2;
- break;
- case "fri":
- countOfMelons += 2;
- countOfWatermelons += 2;
- break;
- case "sat":
- countOfWatermelons++;
- countOfMelons += 2;
- break;
- }
- }
- if (countOfMelons == countOfWatermelons)
- {
- Console.WriteLine("Equal amount: {0}", countOfMelons);
- }
- else if (countOfMelons > countOfWatermelons)
- {
- Console.WriteLine("{0} more melons", countOfMelons - countOfWatermelons);
- }
- else
- {
- Console.WriteLine("{0} more watermelons", countOfWatermelons - countOfMelons);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement