Advertisement
Spocoman

Gold Mine

Nov 27th, 2021 (edited)
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 KB | None | 0 0
  1. using System;
  2.  
  3. namespace GoldMine
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int locations = int.Parse(Console.ReadLine());
  10.  
  11.             for (int i = 0; i < locations; i++)
  12.             {
  13.                 double averageGold = double.Parse(Console.ReadLine());
  14.                 int dayDigging = int.Parse(Console.ReadLine());
  15.                 double goldSum = 0;
  16.  
  17.                 for (int j = 0; j < dayDigging; j++)
  18.                 {
  19.                     goldSum += double.Parse(Console.ReadLine()); ;
  20.                 }
  21.  
  22.                 if ((goldSum / dayDigging) >= averageGold)
  23.                 {
  24.                     Console.WriteLine($"Good job! Average gold per day: { goldSum / dayDigging:f2}.");
  25.                 }
  26.                 else
  27.                 {
  28.                     Console.WriteLine($"You need {averageGold - (goldSum / dayDigging):f2} gold.");
  29.                 }
  30.             }
  31.         }
  32.     }
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement