Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _01_BlackFlag
- {
- class Program
- {
- static void Main(string[] args)
- {
- int totalDays = int.Parse(Console.ReadLine());
- int dailyPlunder = int.Parse(Console.ReadLine());
- double expectedPlunderInTheEnd = double.Parse(Console.ReadLine());
- double totalPlunder = 0;
- for (int i = 1; i <= totalDays; i++)
- {
- totalPlunder += dailyPlunder;
- if (i % 3 == 0)
- {
- totalPlunder += 0.5 * dailyPlunder;
- }
- else if (i % 5 == 0)
- {
- totalPlunder *= 0.7;
- }
- }
- if (totalPlunder >= expectedPlunderInTheEnd)
- {
- Console.WriteLine($"Ahoy! {totalPlunder:f2} plunder gained.");
- }
- else
- {
- double percent = totalPlunder * 100 / expectedPlunderInTheEnd;
- Console.WriteLine($"Collected only {percent:f2}% of the plunder.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment