06.Gold Mine
06.Gold Mine
Някой да има решение на този задача беше на изпита ми и така и не успях да я реша за C#.
06.Gold Mine
Някой да има решение на този задача беше на изпита ми и така и не успях да я реша за C#.
using System;
namespace Izpit8
{
internal class Program
{
static void Main(string[] args)
{
int numLocations = int.Parse(Console.ReadLine());
for (int i = 0; i < numLocations; i++)
{
double goldPerDay = double.Parse(Console.ReadLine());
int numDays = int.Parse(Console.ReadLine());
double sumGoldForDay = 0;
for (int k = 0; k < numDays; k++)
{
double minedGoldDay = double.Parse(Console.ReadLine());
sumGoldForDay += minedGoldDay;
}
double averageGold = sumGoldForDay / numDays;
if (averageGold >= goldPerDay)
{
Console.WriteLine($"Good job! Average gold per day: {averageGold:f2}.");
}
else
{
Console.WriteLine($"You need {(goldPerDay - averageGold):f2} gold.");
}
}
}
}
}
I have never encountered such a case. But I think if it's a game then it's a good architectural idea for you to switch to getaway shootout because I haven't had any weird issues with it.