TOPIC
Time limit exceeded
taugusto6 asked 2 years ago
Using System;
class URI {
static void Main(string[] args) {
int inicio, fim, duracao = 0;
string line;
line = Console.ReadLine();
string[] values = line.Split(' ');
inicio = int.Parse(values[0]);
fim = int.Parse(values[1]);
int i = inicio;
if(i==0 && fim == 0)
{
Console.WriteLine($"O JOGO DUROU 24 HORA(S)");
}
else
{
do
{
if (i == 24)
{
i = 0;
}
i++;
duracao++;
} while (i != fim);
Console.WriteLine($"O JOGO DUROU {duracao} HORA(S)");
}
}
}
Alguém poderia me ajudar, tá dando tempo excedido, o que eu posso fazer pra otimizar o código?
This topic has not been answered yet. Be the first!