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