Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- public class Program
- {
- public static void Main()
- {
- double budget = double.Parse(Console.ReadLine());
- int students = int.Parse(Console.ReadLine());
- double pricePerSaber = double.Parse(Console.ReadLine());
- double pricePerRobe = double.Parse(Console.ReadLine());
- double pricePerBelt = double.Parse(Console.ReadLine());
- double totalRobesPrice =Math.Round(pricePerRobe * students,2);
- double sabresNeeded =Math.Ceiling(students * 1.10);
- double totalSabresPrice =Math.Round(sabresNeeded*pricePerSaber,2);
- int freeBelts = students /6;
- int beltsNeeded = students - freeBelts;
- double totalBeltsPrice =Math.Round(beltsNeeded * pricePerBelt,2);
- double totalCost =Math.Round(totalRobesPrice + totalSabresPrice + totalBeltsPrice,2);
- if (totalCost <= budget)
- {
- Console.WriteLine("The money is enough - it would cost {0:f2}lv.", totalCost);
- }
- else
- {
- Console.WriteLine("Ivan Cho will need {0:f2}lv more.", totalCost-budget);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment