Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp2
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- //INPUT
- int numberLocations = int.Parse(Console.ReadLine());
- //CHANGEABLE INPUT
- double expectedGoldForOneDay = 0;
- int daysAtCurrentLoacation = 0;
- double goldForTheDay = 0;
- double goldDaysSum = 0;
- double goldDaysAverage = 0;
- //CALCULATIONS
- for (int i = 1; i <= numberLocations; i++)
- {
- expectedGoldForOneDay = double.Parse(Console.ReadLine());
- daysAtCurrentLoacation = int.Parse(Console.ReadLine());
- for (int j = 1; j <= daysAtCurrentLoacation; j++)
- {
- goldForTheDay = double.Parse(Console.ReadLine());
- goldDaysSum += goldForTheDay;
- goldDaysAverage = goldDaysSum / daysAtCurrentLoacation;
- }
- if (goldDaysAverage >= expectedGoldForOneDay)
- {
- Console.WriteLine($"Good job! Average gold per day: {(goldDaysAverage):f2}.");
- }
- else
- {
- Console.WriteLine($"You need {(expectedGoldForOneDay - goldDaysAverage):f2} gold.");
- }
- //CLEAR DATA
- goldForTheDay = 0;
- goldDaysSum = 0;
- goldDaysAverage = 0;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement