TÓPICO

Wrong Answer 5%

Edson47 perguntou 3 years ago

Galera,

Gostaria de uma ajuda, pq o URI não está aceitando o código, reporta Wrong Answer 5%.... Estou rodando na IDE, e está perfeito!!

Obrigado,

Edson

Lembre de não publicar soluções. Sua publicação pode ser revisada por nossos moderadores.

  • Edson47 respondido 3 years ago

    import java.util.Scanner;

    public class Main {

    public static void main(String[] args) {
    
        Scanner sc = new Scanner(System.in);
    
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();
        int f, g, h, i, j;
        int somaPar;
        int somaImpar;
        int somaPositivo;
        int somaNegativo;
    
        if (a % 2 == 0) {
            f = 1;
        }
        else {
            f = 0;
        }
        if (b % 2 == 0) {
            g = 1;
        }
        else {
            g = 0;
        }
        if (c % 2 == 0) {
            h = 1;
        }
        else {
            h = 0;
        }
        if (d % 2 == 0) {
            i = 1;
        }
        else {
            i = 0;
        }
        if (e % 2 == 0) {
            j = 1;
        }
        else {
            j = 0;
        }
        somaPar = f + g + h + i + j;
        somaImpar = 5 - somaPar;
    
        if (a > 0) {
            f = 1;
        }
        else {
            f = 0;
        }
        if (b > 0) {
            g = 1;
        }
        else {
            g = 0;
        }
        if (c > 0) {
            h = 1;
        }
        else {
            h = 0;
        }
        if (d > 0) {
            i = 1;
        }
        else {
            i = 0;
        }
        if (e > 0) {
            j = 1;
        }
        else {
            j = 0;
        }
        somaPositivo = f + g + h + i + j; 
    
        if (a < 0) {
            f = 1;
        }
        else {
            f = 0;
        }
        if (b < 0) {
            g = 1;
        }
        else {
            g = 0;
        }
        if (c < 0) {
            h = 1;
        }
        else {
            h = 0;
        }
        if (d < 0) {
            i = 1;
        }
        else {
            i = 0;
        }
        if (e < 0) {
            j = 1;
        }
        else {
            j = 0;
        }
        somaNegativo = f + g + h + i + j;
    
        System.out.println(somaPar + " valor(es) par(es)");
        System.out.println(somaImpar + " valor(es) ímpar(es)");
        System.out.println(somaPositivo + " valor(es) positivo(s)");
        System.out.println(somaNegativo + " valor(es) negativo(s)");
    
        sc.close(); 
    }

    }

  • sorryizaque respondido 3 years ago

    para te ajudar tenho que olhar codigo se não eu não posso fazer nada.

  • Edson47 respondido 3 years ago

    O código está correto, roda na IDE....

  • sorryizaque respondido 3 years ago

    posta seu codigo, que o povo iria comentar, alguns iria olhar codigo, outros iriam passar entradas que seu programa não funciona ou iriam reportar problema