Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Suitcases_Load
- {
- class Program
- {
- static void Main(string[] args)
- {
- double capacityTrunk = double.Parse(Console.ReadLine());
- double freeSpace = 0;
- int countLuggade = 0;
- string command = Console.ReadLine();
- while(command != "End")
- {
- double volumeTrunk = double.Parse(command);
- countLuggade++;
- volumeTrunk++;
- freeSpace += volumeTrunk;
- capacityTrunk-=volumeTrunk;
- if (countLuggade % 3 == 0)
- {
- volumeTrunk *= 0.10;
- }
- if (volumeTrunk > freeSpace)
- {
- Console.WriteLine("No more space!");
- break;
- }
- command = Console.ReadLine();
- }
- if (command == "End")
- {
- Console.WriteLine("Congratulations! All suitcases are loaded!");
- }
- Console.WriteLine($"Statistic: {countLuggade} suitcases loaded.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement