Endurance Rally Programming Fundamentals Help
Здравейте,
Моля помогнете ми със задача 03.Endurance Rally - https://judge.softuni.bg/Contests/Compete/Index/453#2
дава ми рънтайм еррор на 8-ми тест и не мога да разбера защо.
Ето кода:
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
class Startup
{
static void Main()
{
CultureInfo invC = CultureInfo.InvariantCulture;
var isBreaked = false;
var drivers = new Dictionary<string, double>();
var getDrivers = Regex.Split(Console.ReadLine(), @"\s+").ToList();
var zones = Regex.Split(Console.ReadLine(), @"\s+").Select(double.Parse).ToArray();
var checkpoints = new List<decimal>();
string input = Console.ReadLine();
if (!String.IsNullOrEmpty(input))
{
checkpoints = Regex.Split(input, @"\s+").Select(decimal.Parse).ToList();
}
foreach (var driver in getDrivers)
{
drivers.Add(driver, (double)((int)driver[0]));
}
foreach (var driverr in getDrivers)
{
isBreaked = false;
for (int i = 0; i < zones.Length; i++)
{
if (checkpoints.Contains(i))
{
drivers[driverr] += zones[i];
}
else
{
drivers[driverr] -= zones[i];
}
if(drivers[driverr] <= 0)
{
Console.WriteLine($"{driverr} - reached {i}");
isBreaked = true;
break;
}
}
if(!isBreaked == true)
{
Console.WriteLine($"{driverr} - fuel left {string.Format("{0:0.00}", drivers[driverr])}");
}
}
}
}
Благодаря предварително.
Благодаря ти много :)