TOPIC

1243-O Quão Fácil é. Não consigo ler a entrada

LFCL10 asked 2 years ago

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

public class Main {

public static void main(String[] args) throws IOException {

    while (true){
        Scanner in = new Scanner(System.in);
        String titulo;
        titulo = in.next();
        if (titulo.equals("EOF")) {
            break;
        }
        String[] palavras = titulo.split(" ");
        int media = 0, divisor = palavras.length;
        for (String palavra : palavras) {
            media = media + palavra.length();
        }
        media = media/divisor+1;
        int dificuldade = 0;
        if (media<=3) {
            dificuldade = 250;
        }else if (media<=5){
            dificuldade = 500;
        }else if (media>=6){
            dificuldade = 1000;
        }
        System.out.println(dificuldade);
    }

}

}

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

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