fork download
  1. import java.io.*;
  2.  
  3. class Test {
  4. public static void main(String[] args) {
  5. try {
  6. String in = readConsoleInput();
  7. int score = Integer.parseInt(in);
  8. System.out.println(grade(score));
  9. } catch (IOException e) {
  10. System.out.println("バカ");
  11. } catch (NumberFormatException e) {
  12. System.out.println("マジで死ねバカ");
  13. }
  14. }
  15.  
  16. private static String readConsoleInput() throws IOException {
  17. try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
  18. return reader.readLine();
  19. }
  20. }
  21.  
  22. private static String grade(int score) {
  23. if (80 <= score && score <= 100) {
  24. return "A";
  25. } else if (60 <= score) {
  26. return "B";
  27. } else if (40 <= score) {
  28. return "C";
  29. } else if (20 <= score) {
  30. return "D";
  31. } else {
  32. return "E 死ねバカ";
  33. }
  34. }
  35. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
バカ