Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Fishing
- {
- class MainClass
- {
- public static void Main(string[] args)
- {
- var quota = int.Parse(Console.ReadLine());
- int fishes = 0;
- decimal total = 0;
- while (true)
- {
- fishes++;
- if (fishes > quota)
- {
- Console.WriteLine("Lyubo fulfilled the quota!");
- break;
- }
- var name = Console.ReadLine();
- if (name == "Stop")
- break;
- var kg = double.Parse(Console.ReadLine());
- decimal sum = 0;
- for (int i = 0; i < name.Length; i++)
- {
- sum += name[i];
- }
- sum /= (decimal)kg;
- if (fishes % 3 == 0)
- total += sum;
- else
- total -= sum;
- }
- if(total>0)
- Console.WriteLine($"Lyubo's profit from {fishes-1} fishes is {total:f2} leva.");
- else
- Console.WriteLine($"Lyubo lost {-total:f2} leva today.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement