Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace GoldMine
- {
- class Program
- {
- static void Main(string[] args)
- {
- int locations = int.Parse(Console.ReadLine());
- for (int i = 0; i < locations; i++)
- {
- double expectedYield = double.Parse(Console.ReadLine());
- int days = int.Parse(Console.ReadLine());
- double locationYield = 0;
- for (int j = 0; j < days; j++)
- {
- double goldYield = double.Parse(Console.ReadLine());
- locationYield += goldYield;
- }
- double averageYield = locationYield / days;
- if(expectedYield > averageYield)
- {
- Console.WriteLine($"You need {expectedYield - averageYield:f2} gold.");
- }
- else
- {
- Console.WriteLine($"Good job! Average gold per day: {averageYield:f2}.");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement