Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main(string[] args)
- {
- int quota = int.Parse(Console.ReadLine());
- double lostMoney = 0;
- double fishSum = 0;
- int fishCounter = 0;
- double earnedMoney = 0;
- for (int i = 1; i <= quota; i++)
- {
- string input = Console.ReadLine();
- double fishKg = double.Parse(Console.ReadLine());
- fishCounter++;
- for (int counter = 0; counter < input.Length; counter++)
- {
- char symbol = input[counter];
- fishSum += symbol;
- }
- lostMoney += fishSum / fishKg;
- fishSum = 0;
- if (i % 3 == 0 || input == "Stop")
- {
- if (fishCounter == quota)
- {
- Console.WriteLine("Lyubo fulfilled the quota!");
- }
- earnedMoney = fishSum / fishKg;
- }
- }
- if (earnedMoney > lostMoney)
- {
- double leftMoney = earnedMoney - lostMoney;
- Console.WriteLine($"Lyubo's profit from {fishCounter} fishes is {leftMoney:F2} leva.");
- }
- else
- {
- double leftMoney = lostMoney - earnedMoney;
- Console.WriteLine($"Lyubo lost {leftMoney:F2} leva today.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment