結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
49,236 KB
testcase_01 AC 48 ms
49,184 KB
testcase_02 AC 49 ms
49,116 KB
testcase_03 AC 49 ms
49,476 KB
testcase_04 AC 49 ms
49,368 KB
testcase_05 AC 48 ms
49,480 KB
testcase_06 AC 48 ms
49,292 KB
testcase_07 AC 49 ms
49,352 KB
testcase_08 AC 50 ms
49,232 KB
testcase_09 AC 49 ms
49,096 KB
testcase_10 AC 49 ms
49,312 KB
testcase_11 AC 49 ms
49,300 KB
testcase_12 AC 49 ms
49,300 KB
testcase_13 AC 49 ms
49,476 KB
testcase_14 AC 48 ms
49,232 KB
testcase_15 AC 49 ms
49,588 KB
testcase_16 AC 48 ms
49,168 KB
testcase_17 AC 49 ms
49,600 KB
testcase_18 AC 49 ms
49,332 KB
testcase_19 AC 49 ms
49,636 KB
testcase_20 AC 48 ms
49,232 KB
testcase_21 AC 50 ms
47,776 KB
testcase_22 AC 49 ms
49,284 KB
testcase_23 AC 48 ms
49,296 KB
testcase_24 AC 49 ms
49,232 KB
testcase_25 AC 48 ms
49,292 KB
testcase_26 AC 50 ms
49,228 KB
testcase_27 AC 48 ms
49,176 KB
testcase_28 AC 49 ms
47,576 KB
testcase_29 AC 50 ms
49,148 KB
testcase_30 AC 50 ms
49,240 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 <= 100000; 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