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