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