Created
July 27, 2014 22:52
-
-
Save boyanov83/13f15190f547eaf99c94 to your computer and use it in GitHub Desktop.
Авторско решение
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class MelonsAndWatermelons | |
{ | |
private static void Main() | |
{ | |
int startDayOfWeek = int.Parse(Console.ReadLine()); | |
int daysEating = int.Parse(Console.ReadLine()); | |
int melons = 0; | |
int watermelons = 0; | |
for (int i = startDayOfWeek; i < daysEating + startDayOfWeek; i++) | |
{ | |
switch (i % 7) | |
{ | |
case 1: | |
watermelons += 1; | |
break; | |
case 2: | |
melons += 2; | |
break; | |
case 3: | |
watermelons += 1; | |
melons += 1; | |
break; | |
case 4: | |
watermelons += 2; break; | |
case 5: | |
melons += 2; | |
watermelons += 2; | |
break; | |
case 6: | |
watermelons += 1; | |
melons += 2; | |
break; | |
default: | |
break; | |
} | |
} | |
int diff = Math.Abs(melons - watermelons); | |
if (melons > watermelons) | |
{ | |
Console.WriteLine("{0} more melons", diff); | |
} | |
else if (watermelons > melons) | |
{ | |
Console.WriteLine("{0} more watermelons ", diff); | |
} | |
else | |
{ | |
Console.WriteLine("Equal amount: {0}", melons); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment