TOPIC
Wrong answer (5%) - C -
mfigueiredo7 asked 4 years ago
Alguém poderia dar uma luz? Fiz esse código e está dando erro ainda, porém está tudo funcionando como deveria "/.
#include <stdio.h>
#include <math.h>
int rafael(int x, int y){
//(3x)² + y²
int total = 0;
total = ((pow(3*x, 2)) + (pow(y, 2)));
return total;
}
int beto(int x, int y){
//2(x²) + (5y)²
int total = 0;
total = (2 * (pow(x, 2)) + (pow(5 * y, 2)));
return total;
}
int carlos (int x, int y){
//-100x + y³.
int total = 0;
total = (-100 * x + (pow(y, 3)));
return total;
}
int compara(int r, int b, int c){
if(c > r && c > b)
printf("Carlos ganhou");
else if(r > b && r > c)
printf("Rafael ganhou");
else if(b > c && b > r)
printf("Beto ganhou");
}
int main()
{
int N, x, y, r, b, c, maior, i = 0;
scanf("%d", &N);
while(i < N){
i++;
scanf("%d", &x);
scanf("%d", &y);
r = rafael(x, y);
b = beto(x, y);
c = carlos(x, y);
maior = compara(r, b, c);
}
printf("\n");
return 0;
}