Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace P01PartyProfit
- {
- class Program
- {
- static void Main(string[] args)
- {
- int companionsCount = int.Parse(Console.ReadLine());
- int days = int.Parse(Console.ReadLine());
- int tempCount = companionsCount;
- double coinsPerCompanion = 0;
- int coins = 0;
- for(int i = 1; i <= days; i++)
- {
- coins += 50;
- coins -= 2 * companionsCount;
- if (i % 10 == 0)
- {
- companionsCount -= 2;
- }
- if (companionsCount <= 0)
- {
- break;
- }
- if (i % 15 == 0)
- {
- companionsCount += 5;
- }
- if (i % 3 == 0)
- {
- coins -= 3 * companionsCount;
- }
- if (i % 5 == 0)
- {
- coins += 20 * companionsCount;
- }
- if(i%3==0 && i % 5 == 0)
- {
- coins -= 2 * companionsCount;
- }
- }
- if (companionsCount <= 0)
- {
- coinsPerCompanion = Math.Round((double)(coins / tempCount));
- Console.WriteLine($"{tempCount} companions received {coinsPerCompanion} coins each.");
- }
- else
- {
- coinsPerCompanion = Math.Round((double)(coins / companionsCount));
- Console.WriteLine($"{companionsCount} companions received {coinsPerCompanion} coins each.");
- }
- // Console.WriteLine($"{companionsCount} companions received {coinsPerCompanion} coins each.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement