コード例 #1
0
  public static void main(String[] args) throws IOException {
    Scanner sc = new Scanner(System.in);
    PrintWriter out = new PrintWriter(System.out);
    sc.waitForInput(3000);
    nCr(2005);
    while (sc.Ready()) out.println(Cat(sc.nextInt()));

    out.flush();
    out.close();
  }
コード例 #2
0
  public static void main(String[] args) throws IOException {
    Scanner sc = new Scanner(System.in);
    PrintWriter out = new PrintWriter(System.out);

    sc.waitForInput(2000);
    int n;
    dp = new int[100];
    Arrays.fill(dp, -1);
    while (sc.Ready()) {
      n = sc.nextInt();
      out.println(rec(n));
    }

    out.flush();
    out.close();
  }
コード例 #3
0
  public static void main(String[] args) throws IOException {
    Scanner sc = new Scanner(System.in);
    PrintWriter out = new PrintWriter(System.out);

    sc.waitForInput(3000);
    TreeSet<String> ts = new TreeSet<>();
    String temp = "";
    boolean flag = false;
    while (sc.Ready()) {
      String line = sc.nextLine();
      if (line.isEmpty()) continue;

      line = line.toLowerCase();
      flag = false;
      int len = line.length();
      for (int i = 0; i < len; i++) {
        if (line.charAt(i) >= 'a' && line.charAt(i) <= 'z') temp += line.charAt(i);
        else if (line.charAt(i) == '-') {
          if (i != len - 1) temp += line.charAt(i);
          else flag = true;
        } else {
          if (!temp.isEmpty() && !ts.contains(temp)) ts.add(temp);
          temp = "";
        }
      }

      if (flag) continue;
      if (!temp.isEmpty() && !ts.contains(temp)) ts.add(temp);

      temp = "";
    }

    if (flag) temp += '-';
    if (!temp.isEmpty() && !ts.contains(temp)) ts.add(temp);

    for (String s : ts) out.println(s);

    out.flush();
    out.close();
  }