TOPIC
TIMELIMIT EXCEEDED
gteixeira34 asked 4 years ago
using System;
// Exercicio 1329
public class Program
{
public static void Main()
{
int contador = int.Parse(Console.ReadLine());
int joao;
int maria;
string entrada;
int[] jogos;
while (contador != 0)
{
joao = 0;
maria = 0;
entrada = Console.ReadLine();
jogos = new int[contador];
for (int i = 0; i < jogos.Length; i++)
{
jogos[i] = int.Parse(entrada.Split(' ')[i]);
if (jogos[i] == 0)
{
maria++;
}
else
{
joao++;
}
}
Console.WriteLine("Mary won " + maria + " times and John won " + joao + " times");
contador = int.Parse(Console.ReadLine());
}
}
}
Meu condigo pelo que parece está lento, alguem tem alguma ideia para otimiza-lo?
This topic has not been answered yet. Be the first!