Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Fishing
- {
- class Program
- {
- static void Main(string[] args)
- {
- int Kvota = int.Parse(Console.ReadLine());
- string NameFish = Console.ReadLine();
- int PriceNameFish = 0;
- double PriceFish = 0;
- double TotalMoney = 0;
- int CountFish = 0;
- double KgFish = 0;
- for (int i = 1; i <= Kvota; i++)
- {
- if (NameFish != "Stop")
- {
- KgFish = double.Parse(Console.ReadLine());
- CountFish++;
- for (int j = 0; j < NameFish.Length; j++)
- {
- char Symbol = NameFish[j];
- int NumSymbol = Symbol;
- PriceNameFish += NumSymbol;
- }
- PriceFish = PriceNameFish / KgFish;
- PriceNameFish = 0;
- if (i % 3 == 0)
- {
- TotalMoney += PriceFish;
- }
- else
- {
- TotalMoney -= PriceFish;
- }
- NameFish = Console.ReadLine();
- }
- }
- if (CountFish == Kvota)
- {
- Console.WriteLine("Lyubo fulfilled the quota!");
- }
- if (TotalMoney >= 0)
- {
- Console.WriteLine($"Lyubo's profit from {CountFish} fishes is {TotalMoney:f2} leva.");
- }
- else
- {
- Console.WriteLine($"Lyubo lost {Math.Abs(TotalMoney):f2} leva today. ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment