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 Lubo_fisherman
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- string fish = string.Empty;
- double profit = 0;
- double price = 0.00;
- int count = 0;
- while (fish != "Stop")
- {
- for (int i = 1; i <= n; i++)
- {
- fish = Console.ReadLine();
- if (fish == "Stop")
- { break; }
- double kg = double.Parse(Console.ReadLine());
- for (int m = 0; m < fish.Length; m++)
- {
- price += fish[m];
- }
- price = (price / kg);
- if (i == 3)
- {
- profit += price;
- }
- else
- {
- profit -= price;
- }
- count++;
- price = 0;
- }
- if (count == n)
- {
- Console.WriteLine("Lyubo fulfilled the quota!");
- break;
- }
- }
- if (profit >= 0)
- {
- Console.WriteLine($"Lyubo's profit from {count} fishes is {profit:f2} leva.");
- }
- else
- {
- Console.WriteLine($"Lyubo lost {Math.Abs(profit):f2} leva today.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement