Advertisement
spasnikolov131

Untitled

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