Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class HelloWorld
- {
- public static void Main(string[] args)
- {
- double capacity = double.Parse(Console.ReadLine());
- //След това до получаване на команда "End" или до запълване на багажника, се чете по един ред:
- string volumeSuitcase = Console.ReadLine();
- int count = 0;
- double sum = 0;
- double currSumVolume = 0;
- while (volumeSuitcase != "End")
- {
- double volume = double.Parse(volumeSuitcase);
- if ((count + 1) % 3 == 0)
- {
- volume = volume + volume * 0.1;
- }
- sum += volume;
- if (capacity < sum)
- {
- break;
- }
- count++;
- volumeSuitcase = Console.ReadLine();
- }
- if (volumeSuitcase == "End")
- {
- Console.WriteLine("Congratulations! All suitcases are loaded!");
- }
- if (sum > capacity)
- {
- Console.WriteLine("No more space!");
- }
- Console.WriteLine($"Statistic: {count} suitcases loaded.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement