Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.
/**Bismillahir Rahmanir Rahim.**/ #include <stdio.h> int main() { int tst, Dab, Gab, a1, a2, d1, d2, l1, l2, bns; scanf("%d", &tst); while(tst--) { scanf("%d", &bns); scanf("%d %d %d", &a1, &d1, &l1); scanf("%d %d %d", &a2, &d2, &l2); Dab = (a1+d1)/2; if(l1%2==0) Dab += bns; Gab = (a2+d2)/2; if(l2%2==0) Gab += bns; if(Dab == Gab) printf("Empate\n"); else printf((Dab > Gab)? "Dabriel\n" : "Guarte\n"); } return 0; }
nice
ReplyDelete, but my code is wrong for the uri wtf
#include
ReplyDeleteint main(void)
{
int I,B,A1,D1,N1,A2,D2,N2,ValorGolpe1,ValorGolpe2,Maior,N;
scanf("%d", &I);
for (N = 0; N < I; N++){
scanf("%d", &B);
scanf("%d%d%d",&A1,&D1,&N1);
scanf("%d%d%d",&A2,&D2,&N2);
ValorGolpe1 = ((A1+D1)/2);
ValorGolpe2 = ((A2+D2)/2);
if (N1 % 2 == 0)
{
ValorGolpe1 = ValorGolpe1 + B;
}
else if (N2 % 2 == 0)
{
ValorGolpe2 = ValorGolpe2 + B;
}
else if (N1 % 2 == 0 && N2 % 2 == 0)
{
ValorGolpe1 = ValorGolpe1 + B;
ValorGolpe2 = ValorGolpe2 + B;
}
Maior = (ValorGolpe1 > ValorGolpe2) ? ValorGolpe1 : ValorGolpe2;
if(ValorGolpe1 == ValorGolpe2)
{
printf("Empate\n");
}
else if ( Maior == ValorGolpe1)
{
printf("Dabriel\n");
}
else if (Maior == ValorGolpe2)
{
printf("Guarte\n");
}
}
return 0;
}
5% ERROR