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