1
My teacher recommended this site called Uri, and I’m managing to solve some issues, only that in this tried all the solutions that the question posed and the program that I made out the requested results in the question, the judge Uri is giving 30% error but do not know how to correct the error.
Here is my code.
#include <stdio.h>
int main(void)
{
int teste, altura, i, maior;
scanf("%d %d", &altura, &teste);
int vetor[teste], vetorb[teste], vetorc[teste], c = 0, b = 0,
vetorf[teste];
for(i = 0; i < teste; i++)
{
scanf("%d", &vetor[i]);
}
for(i = 0; i < teste; i++)
{
if(i % 2 == 0)
{
vetorc[c++] = vetor[i];
}
else
{
vetorb[b++] = vetor[i];
}
}
for(i = 0; i < c + b; i++)
{
vetorf[i] = vetorb[i] - vetorc[i];
}
maior = vetorf[0];
for(i = 0; i < b; i++)
{
if(vetorf[i] > maior)
{
maior = vetorf[i];
}
}
if(maior > altura)
{
printf("GAME OVER\n");
}
else
{
printf("YOU WIN\n");
}
return 0;
}