Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Disneyland_Journey
- {
- class Program
- {
- static void Main(string[] args)
- {
- decimal jurneyCost = decimal.Parse(Console.ReadLine());
- int numMonths = int.Parse(Console.ReadLine());
- decimal monthSum = jurneyCost * 25/100;
- decimal totalSum = 0;
- decimal spentOdd = 0;
- decimal bonusFourhtMonth = 0;
- for (int i = 1; i <= numMonths; i++)
- {
- spentOdd = 0;
- bonusFourhtMonth = 0;
- if(i%4 == 0)
- {
- bonusFourhtMonth += totalSum * 25/100;
- totalSum += monthSum +bonusFourhtMonth;
- }
- else if(i%2 != 0 && i!=1)
- {
- spentOdd -= totalSum * 16/100 ;
- totalSum += (monthSum+spentOdd);
- }
- else
- {
- totalSum += monthSum;
- }
- }
- decimal result = Math.Abs(jurneyCost - totalSum);
- if (totalSum >= jurneyCost)
- {
- Console.WriteLine($"Bravo! You can go to Disneyland and you will have {(result):F2}lv. for souvenirs.");
- }
- else
- {
- Console.WriteLine($"Sorry. You need {(result):f2}lv. more.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement