結果

問題 No.2 素因数ゲーム
ユーザー mastersatoshimastersatoshi
提出日時 2015-08-01 08:50:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,131 ms / 5,000 ms
コード長 889 bytes
コンパイル時間 2,105 ms
コンパイル使用メモリ 71,708 KB
実行使用メモリ 51,320 KB
最終ジャッジ日時 2023-08-27 04:02:20
合計ジャッジ時間 6,968 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,396 KB
testcase_01 AC 43 ms
49,292 KB
testcase_02 AC 44 ms
49,296 KB
testcase_03 AC 44 ms
49,304 KB
testcase_04 AC 43 ms
49,200 KB
testcase_05 AC 43 ms
49,816 KB
testcase_06 AC 42 ms
49,308 KB
testcase_07 AC 43 ms
49,248 KB
testcase_08 AC 81 ms
51,320 KB
testcase_09 AC 44 ms
49,292 KB
testcase_10 AC 44 ms
49,620 KB
testcase_11 AC 44 ms
49,356 KB
testcase_12 AC 44 ms
49,232 KB
testcase_13 AC 44 ms
49,236 KB
testcase_14 AC 46 ms
49,168 KB
testcase_15 AC 43 ms
49,392 KB
testcase_16 AC 44 ms
49,448 KB
testcase_17 AC 55 ms
51,068 KB
testcase_18 AC 44 ms
49,332 KB
testcase_19 AC 643 ms
50,072 KB
testcase_20 AC 447 ms
51,292 KB
testcase_21 AC 1,131 ms
51,044 KB
testcase_22 AC 78 ms
50,072 KB
testcase_23 AC 44 ms
49,364 KB
testcase_24 AC 47 ms
49,276 KB
testcase_25 AC 74 ms
50,008 KB
testcase_26 AC 43 ms
49,360 KB
testcase_27 AC 43 ms
49,284 KB
testcase_28 AC 43 ms
49,328 KB
testcase_29 AC 43 ms
49,180 KB
testcase_30 AC 45 ms
49,332 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 = Integer.MIN_VALUE;

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

                    count++;
                } else {
                    if (z == Integer.MIN_VALUE) {
                        z = count;
                    } else {
                        z = z ^ count;
                    }
                    break;
                }
            }
        }

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