Suitcases Load Online Exam 28 and 19 March
Здрявейте,
Бихте ли ми помогнали за тази задача?
На втория тест ми дава Runtime error и не мога да си обясня защо.
Ето кода:
using System;
using System.Numerics;
namespace _05SuitcasesLoad
{
class Program
{
static void Main(string[] args)
{
double planeCapacity = double.Parse(Console.ReadLine());
string input = Console.ReadLine();
int suitcaseCounter = 0;
while (input != "End")
{
double suitcaseVolume = double.Parse(input);
if (suitcaseCounter + 1 % 3 == 0)
{
suitcaseVolume = suitcaseVolume * 1.1;
}
if (planeCapacity <= suitcaseVolume)
{
break;
}
suitcaseCounter++;
planeCapacity -= suitcaseVolume;
input = Console.ReadLine();
}
if (input == "End")
{
Console.WriteLine("Congratulations! All suitcases are loaded!");
}
else
{
Console.WriteLine("No more space!");
}
Console.WriteLine($"Statistic: {suitcaseCounter} suitcases loaded.");
}
}
}
Благодаря!
Thank you so much!
I would have never thought about that.