結果

問題 No.2 素因数ゲーム
ユーザー lavoxlavox
提出日時 2021-07-11 20:11:37
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 5,000 ms
コード長 512 bytes
コンパイル時間 3,314 ms
コンパイル使用メモリ 71,912 KB
実行使用メモリ 57,520 KB
最終ジャッジ日時 2023-09-14 20:20:23
合計ジャッジ時間 8,572 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,852 KB
testcase_01 AC 121 ms
55,568 KB
testcase_02 AC 124 ms
55,500 KB
testcase_03 AC 120 ms
56,036 KB
testcase_04 AC 119 ms
55,584 KB
testcase_05 AC 120 ms
55,704 KB
testcase_06 AC 121 ms
55,392 KB
testcase_07 AC 121 ms
55,816 KB
testcase_08 AC 119 ms
55,924 KB
testcase_09 AC 121 ms
55,656 KB
testcase_10 AC 122 ms
55,660 KB
testcase_11 AC 120 ms
53,608 KB
testcase_12 AC 122 ms
55,852 KB
testcase_13 AC 121 ms
55,396 KB
testcase_14 AC 123 ms
55,632 KB
testcase_15 AC 122 ms
55,696 KB
testcase_16 AC 121 ms
55,680 KB
testcase_17 AC 120 ms
55,592 KB
testcase_18 AC 121 ms
57,520 KB
testcase_19 AC 122 ms
55,760 KB
testcase_20 AC 124 ms
55,520 KB
testcase_21 AC 119 ms
55,344 KB
testcase_22 AC 119 ms
55,632 KB
testcase_23 AC 120 ms
55,552 KB
testcase_24 AC 120 ms
55,580 KB
testcase_25 AC 120 ms
55,640 KB
testcase_26 AC 120 ms
56,108 KB
testcase_27 AC 119 ms
55,312 KB
testcase_28 AC 118 ms
55,564 KB
testcase_29 AC 120 ms
55,684 KB
testcase_30 AC 120 ms
54,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = Long.parseLong(sc.next());
		sc.close();
		
		int MAX = 10001;
		long mex = 0;
		for ( int i = 2 ; i < MAX ; i++ ) {
			int cnt = 0;
			while ( N % i == 0 ) {
				N /= i;
				cnt++;
			}
			if ( cnt > 0 ) mex = mex ^ cnt;
		}
		
		if ( N > 1 ) {
			mex = mex ^ 1;
		}
		
		if ( mex == 0 ) {
			System.out.println("Bob");
		} else {
			System.out.println("Alice");
		}
	}
}
0