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