Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Fishing
- {
- class Fishing
- {
- static void Main(string[] args)
- {
- int fish = int.Parse(Console.ReadLine());
- string command = string.Empty;
- double weight = 0;
- int fishCounter = 0;
- int payCounter = 0;
- double spendMoney = 0;
- double lostMoney = 0;
- double result = spendMoney - lostMoney;
- for (int i = 0; i < fish; i++)
- {
- double current = 0;
- command = Console.ReadLine();
- if (command == "Stop")
- {
- break;
- }
- weight = double.Parse(Console.ReadLine());
- for (int s = 0; s < command.Length; s++)
- {
- double name = command[s];
- current += name / weight;
- }
- fishCounter++;
- payCounter++;
- if (payCounter == 3)
- {
- spendMoney += current;
- }
- else
- {
- lostMoney += current;
- }
- }
- if (fishCounter==fish)
- {
- Console.WriteLine("Lyubo fulfilled the quota!");
- }
- if (spendMoney >= lostMoney)
- {
- Console.WriteLine($"Lyubo's profit from {fishCounter} fishes is {(spendMoney - lostMoney):f2} leva.");
- }
- else
- {
- Console.WriteLine($"Lyubo lost {(lostMoney - spendMoney):f2} leva today.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement