結果

問題 No.2 素因数ゲーム
ユーザー mastersatoshimastersatoshi
提出日時 2015-08-01 09:04:24
言語 Java21
(openjdk 21)
結果
AC  
実行時間 45 ms / 5,000 ms
コード長 790 bytes
コンパイル時間 2,247 ms
コンパイル使用メモリ 71,392 KB
実行使用メモリ 49,724 KB
最終ジャッジ日時 2023-08-27 04:02:41
合計ジャッジ時間 5,004 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,448 KB
testcase_01 AC 43 ms
49,168 KB
testcase_02 AC 44 ms
49,248 KB
testcase_03 AC 43 ms
49,140 KB
testcase_04 AC 42 ms
49,176 KB
testcase_05 AC 42 ms
49,228 KB
testcase_06 AC 44 ms
49,308 KB
testcase_07 AC 43 ms
49,344 KB
testcase_08 AC 43 ms
49,400 KB
testcase_09 AC 42 ms
49,264 KB
testcase_10 AC 42 ms
49,724 KB
testcase_11 AC 42 ms
49,140 KB
testcase_12 AC 42 ms
49,252 KB
testcase_13 AC 42 ms
47,244 KB
testcase_14 AC 42 ms
49,268 KB
testcase_15 AC 43 ms
49,216 KB
testcase_16 AC 44 ms
49,368 KB
testcase_17 AC 44 ms
49,156 KB
testcase_18 AC 45 ms
49,364 KB
testcase_19 AC 44 ms
49,392 KB
testcase_20 AC 44 ms
49,276 KB
testcase_21 AC 45 ms
49,224 KB
testcase_22 AC 43 ms
49,224 KB
testcase_23 AC 43 ms
49,252 KB
testcase_24 AC 44 ms
49,148 KB
testcase_25 AC 44 ms
49,472 KB
testcase_26 AC 43 ms
47,324 KB
testcase_27 AC 44 ms
49,252 KB
testcase_28 AC 44 ms
49,260 KB
testcase_29 AC 43 ms
49,312 KB
testcase_30 AC 44 ms
49,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {

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

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        long N = Long.parseLong(br.readLine());

        long z = 0;

        for (long i = 2; i <= 10000; i++) {
            int count = 0;
            while (true) {
                if (N % i == 0) {
                    N = N / i;

                    count++;
                } else {
                    z = z ^ count;
                    break;
                }
            }
        }

        if (N != 1) {
            z ^= 1;
        }

        if (z == 0) {
            System.out.println("Bob");
        } else {
            System.out.println("Alice");
        }
    }
}
0