Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace GiftboxCoverage
- {
- using System;
- class GiftboxCoverageStart
- {
- static void Main()
- {
- int days = int.Parse(Console.ReadLine());
- double budget = double.Parse(Console.ReadLine());
- int people = int.Parse(Console.ReadLine());
- double fuelPrice = double.Parse(Console.ReadLine());
- double foodExpencesPerOne = double.Parse(Console.ReadLine());
- double nightExpencesPerOne = double.Parse(Console.ReadLine());
- double foodExpences = days * people * foodExpencesPerOne;
- double hotelExpences = days * people * nightExpencesPerOne;
- if (people > 10)
- {
- hotelExpences *= 0.75;
- }
- double totalExpences = foodExpences + hotelExpences;
- for (int i = 1; i <= days; i++)
- {
- double kilometers = double.Parse(Console.ReadLine());
- totalExpences += kilometers * fuelPrice;
- if (totalExpences > budget)
- {
- Console.WriteLine($"Not enough money to continue the trip. You need {totalExpences - budget:f2}$ more.");
- return;
- }
- if (i % 3 == 0 || i % 5 == 0)
- {
- totalExpences *= 1.4;
- }
- if (totalExpences > budget)
- {
- Console.WriteLine($"Not enough money to continue the trip. You need {totalExpences - budget:f2}$ more.");
- return;
- }
- if (i % 7 == 0)
- {
- totalExpences -= totalExpences / people;
- }
- }
- Console.WriteLine($"You have reached the destination. You have {budget - totalExpences:F2}$ budget left.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement