TOPIC

Wrong 15% Java

Fernando Amaral asked 3 months ago

import java.io.IOException; import java.util.Locale; import java.util.Scanner;

public class Main {

public static void main(String[] args) throws IOException {
    Locale.setDefault(Locale.US);
    Scanner s = new Scanner(System.in);
    byte a = s.nextByte(), b = s.nextByte(), r = 0;
    s.close();
    if (!extracted(a, b)) {
        if (a > b) {
        r = (byte) ((b-a)+24);
            System.out.printf("O JOGO DUROU %d HORA(S)", r);
        }
        if (b > a) {
            r = (byte) (b - a);
            System.out.printf("O JOGO DUROU %d HORA(S)", r);
        }
    } else {
        System.out.println("O JOGO DUROU 24 HORA(S)");
    }
}

private static boolean extracted(byte a, byte b) {
    if (a == 0 && b == 0) {
        return true;
    }
    return false;
}

}

//quero ver alguem descobrir o erro

This topic has not been answered yet. Be the first!

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