Problem 14. * Boat Simulator - ПРОБЛЕМ
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _14.Boat_Simulator
{
class Program
{
static void Main(string[] args)
{
char boat1 = char.Parse(Console.ReadLine());
char boat2 = char.Parse(Console.ReadLine());
int n = int.Parse(Console.ReadLine());
int upgradeOfFirstBoat = (int)boat1;
int upgradeOfSecondBoat = (int)boat2;
int counterofspeedForFirstBoat = 0;
int counterOfSpeedForSecondBoat = 0;
for (int i = 1; i <= n; i++)
{
string symbols = Console.ReadLine();
if (i % 2 == 1)
{
counterofspeedForFirstBoat += symbols.Length;
if (counterofspeedForFirstBoat >= 50)
{
Console.WriteLine((char)upgradeOfFirstBoat);
break;
}
if (symbols == "UPGRADE")
{
upgradeOfFirstBoat += 3;
counterofspeedForFirstBoat -= 7;
}
}
else if (i % 2 == 0)
{
counterOfSpeedForSecondBoat += symbols.Length;
if (counterofspeedForFirstBoat >= 50)
{
Console.WriteLine((char)upgradeOfFirstBoat);
break;
}
if (symbols == "UPGRADE")
{
upgradeOfSecondBoat += 3;
counterOfSpeedForSecondBoat -= 7;
}
}
}
if (counterofspeedForFirstBoat < 50 && counterOfSpeedForSecondBoat < 50 && counterofspeedForFirstBoat > counterofspeedForFirstBoat)
{
Console.WriteLine((char)upgradeOfFirstBoat);
}
else if (counterofspeedForFirstBoat < 50 && counterOfSpeedForSecondBoat < 50 && counterofspeedForFirstBoat < counterOfSpeedForSecondBoat)
{
Console.WriteLine((char)upgradeOfSecondBoat);
}
}
}
}
Ето ти моя код: https://pastebin.com/Q7uQZC6D
Дано да ти помогне