TOPIC

Java runtime error

Felipe Sêrro asked 1 year ago

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

public class Main {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in).useDelimiter("[,\\s+]");
        int count = 1;
        int x = sc.nextInt();
        int z = sc.nextInt();
        while (z<=x) {
            z = sc.nextInt(); 
        }
        for (int i = x+1; true; i++) {
            x += i;
            count++;
            if (x>z) {
                break;
            }
        } 
        System.out.println(count);
    }
}

Alguém pode me ajudar?

Roda com todas os testes, e dá a resposta certa, mas acusa runtime error quando eu envio.

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

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