結果

問題 No.2016 Countdown Divisors
ユーザー tentententen
提出日時 2022-07-25 14:55:02
言語 Java21
(openjdk 21)
結果
AC  
実行時間 217 ms / 2,000 ms
コード長 1,318 bytes
コンパイル時間 3,681 ms
コンパイル使用メモリ 74,760 KB
実行使用メモリ 56,488 KB
最終ジャッジ日時 2023-09-21 20:27:22
合計ジャッジ時間 8,676 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
49,240 KB
testcase_01 AC 215 ms
55,412 KB
testcase_02 AC 217 ms
55,668 KB
testcase_03 AC 208 ms
55,852 KB
testcase_04 AC 203 ms
54,860 KB
testcase_05 AC 202 ms
55,048 KB
testcase_06 AC 152 ms
54,568 KB
testcase_07 AC 146 ms
54,852 KB
testcase_08 AC 211 ms
55,564 KB
testcase_09 AC 213 ms
55,540 KB
testcase_10 AC 201 ms
55,176 KB
testcase_11 AC 215 ms
55,300 KB
testcase_12 AC 211 ms
55,404 KB
testcase_13 AC 188 ms
56,488 KB
testcase_14 AC 185 ms
54,928 KB
testcase_15 AC 184 ms
54,720 KB
testcase_16 AC 206 ms
55,164 KB
testcase_17 AC 204 ms
55,160 KB
testcase_18 AC 208 ms
54,868 KB
testcase_19 AC 43 ms
49,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int[] targets = new int[]{1, 3, 4, 5, 7, 8};
        HashSet<Integer> ones = new HashSet<>();
        for (int x : targets) {
            ones.add(x);
        }
        int t = sc.nextInt();
        StringBuilder sb = new StringBuilder();
        while (t-- > 0) {
            if (ones.contains(sc.nextInt())) {
                sb.append("1\n");
            } else {
                sb.append("2\n");
            }
        }
        System.out.print(sb);
    }
    
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public String next() throws Exception {
        if (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
}
0