Advertisement
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 number = int.Parse(Console.ReadLine());
- string command = Console.ReadLine();
- double weight = 0;
- double profit = 0;
- int sumOfSymbols = 0;
- while (command!="Stop")
- {
- weight = double.Parse(Console.ReadLine());
- for (int i = 0; i < number-1; i++)
- {
- for (int k = 0; k < command.Length; k++)
- {
- sumOfSymbols += command[k];
- }
- if ((i+1) % 3 == 0)
- {
- profit += sumOfSymbols/weight;
- }
- else
- {
- profit -= sumOfSymbols / weight;
- }
- command = Console.ReadLine();
- if (command=="Stop")
- {
- break;
- }
- weight = double.Parse(Console.ReadLine());
- }
- Console.WriteLine("Lyubo fulfilled the quota!");
- if (profit>=0)
- {
- Console.WriteLine($"Lyubo's profit from {number} fishes is {profit:f2} leva.");
- break;
- }
- else
- {
- Console.WriteLine($"Lyubo lost {Math.Abs(profit):f2} leva today.");
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement