TOPIC

Wrong answer (15%)

rebeca.lopesgmail.com asked 3 years ago

Pessoal,

Sabem o motivo do erro?


#include <stdio.h>

int main() {

    int a, b, c, d;

    scanf("%d", &a);
    scanf("%d", &b);
    scanf("%d", &c);

    if (a > b && a >= c) d = 2*b + 4*c;
    else if (c > b && c <= a) d = 4*a + 2*b;
    else d = 2*a + 2*c;

    printf("%d\n",d);
    return 0;
}

Remember not post solutions. Your post may be reviewed by our moderators.

  • tilnoene replied 3 years ago

    Seu código falha no seguinte caso de teste, cuja resposta esperada é 30:

    5
    5
    20