Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace For
- {
- class Program
- {
- static void Main(string[] args)
- {
- double budget = double.Parse(Console.ReadLine());
- int countSeries = int.Parse(Console.ReadLine());
- double sum = 0.0;
- for (int info = 1; info <= countSeries; info++)
- {
- string serial = Console.ReadLine();
- double priceForSerial = double.Parse(Console.ReadLine());
- if (serial == "Thrones")
- {
- priceForSerial = priceForSerial * 0.5;
- }
- else if(serial == "Lucifer")
- {
- priceForSerial = priceForSerial * 0.6;
- }
- else if (serial == "Protector")
- {
- priceForSerial = priceForSerial * 0.7;
- }
- else if (serial == "TotalDrama")
- {
- priceForSerial = priceForSerial * 0.8;
- }
- else if (serial == "Area")
- {
- priceForSerial = priceForSerial * 0.9;
- }
- else
- {
- priceForSerial = priceForSerial * 1;
- }
- sum += priceForSerial;
- }
- if (budget >= sum)
- {
- Console.WriteLine($"You bought all the series and left with {Math.Abs(budget-sum):f2} lv.");
- }
- else
- {
- Console.WriteLine($"You need {Math.Abs(sum-budget):f2} lv. more to buy the series!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement