Skip to content

Instantly share code, notes, and snippets.

@boyanov83
Created July 28, 2014 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boyanov83/63c9082d70ca120015cc to your computer and use it in GitHub Desktop.
Save boyanov83/63c9082d70ca120015cc to your computer and use it in GitHub Desktop.
using System;
class MelonsWatermelons
{
static void Main()
{
int start = int.Parse(Console.ReadLine());
int days = int.Parse(Console.ReadLine());
int melons = 0;
int waterMelons = 0;
for (int i = 0; i < days; i++)
{
switch (start)
{
case 1:
waterMelons++;
break;
case 2:
melons += 2;
break;
case 3:
waterMelons++;
melons++;
break;
case 4:
waterMelons += 2;
break;
case 5:
waterMelons += 2;
melons += 2;
break;
case 6:
waterMelons++;
melons += 2;
break;
case 7:
break;
default:
Console.WriteLine("Wrong Input");
break;
}
start++;
if (start == 8)
{
start = 1;
}
}
if (melons == waterMelons)
{
Console.WriteLine("Equal amount: "+melons);
}
else if (melons > waterMelons)
{
melons -= waterMelons;
Console.WriteLine(melons + " more melons");
}
else
{
waterMelons -= melons;
Console.WriteLine(waterMelons + " more watermelons");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment