問題:http://atcoder.jp/problem/detail/139
部分点だけもらえるコード.
import java.math.BigInteger; import java.util.*; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); String line = s.nextLine(); if (!s.hasNextLine()) { // BDEFH AC if (line.equals("NO")) { // ACD System.out.println("ACD"); } else if (line.matches("\\d+")) { // BEF BigInteger n = new BigInteger(line); if (n.equals(BigInteger.ZERO)) { System.out.println("E"); } else if (n.equals(BigInteger.ONE)) { System.out.println("BE"); } else if (n.compareTo(BigInteger.valueOf(50)) <= 0) { System.out.println("BEF"); } else if (n.compareTo(BigInteger.valueOf(1000000000)) <= 0) { System.out.println("BF"); } else { System.out.println("B"); } } else { // DH Set<String> set = new HashSet<String>(Arrays.asList("A", "B", "BE", "BEF", "BF", "C", "ACD", "D", "DH", "E", "G")); if (set.contains(line)) { System.out.println("DH"); } else { System.out.println("D"); } } } else { // ACG if (s.nextLine().matches("[a-z]+")) { System.out.println("A"); } else if (line.contains(" ")) { System.out.println("C"); } else { System.out.println("G"); } } } }