結果

問題 No.2 素因数ゲーム
ユーザー CrazyBBBCrazyBBB
提出日時 2016-03-05 19:06:20
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 5,000 ms
コード長 825 bytes
コンパイル時間 2,100 ms
コンパイル使用メモリ 74,232 KB
実行使用メモリ 56,736 KB
最終ジャッジ日時 2023-08-27 04:24:50
合計ジャッジ時間 7,174 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,524 KB
testcase_01 AC 120 ms
56,552 KB
testcase_02 AC 121 ms
55,844 KB
testcase_03 AC 120 ms
56,156 KB
testcase_04 AC 122 ms
55,864 KB
testcase_05 AC 122 ms
55,684 KB
testcase_06 AC 121 ms
56,360 KB
testcase_07 AC 122 ms
56,288 KB
testcase_08 AC 121 ms
56,736 KB
testcase_09 AC 124 ms
55,860 KB
testcase_10 AC 122 ms
55,676 KB
testcase_11 AC 122 ms
55,752 KB
testcase_12 AC 126 ms
56,176 KB
testcase_13 AC 122 ms
55,852 KB
testcase_14 AC 121 ms
56,076 KB
testcase_15 AC 119 ms
55,824 KB
testcase_16 AC 119 ms
55,560 KB
testcase_17 AC 118 ms
56,188 KB
testcase_18 AC 121 ms
55,540 KB
testcase_19 AC 120 ms
56,460 KB
testcase_20 AC 120 ms
55,472 KB
testcase_21 AC 122 ms
56,052 KB
testcase_22 AC 122 ms
56,088 KB
testcase_23 AC 120 ms
56,484 KB
testcase_24 AC 122 ms
55,476 KB
testcase_25 AC 122 ms
55,836 KB
testcase_26 AC 120 ms
55,984 KB
testcase_27 AC 120 ms
56,200 KB
testcase_28 AC 121 ms
55,792 KB
testcase_29 AC 119 ms
55,780 KB
testcase_30 AC 120 ms
55,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	static int[] S;
	static int[] T;
	static int[] Y;
	static int[] M;
	static int[][] dp;
	static final int INF = Integer.MAX_VALUE/2;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		List<Integer> list = new ArrayList<>();

		if (N == 1) {
			list.add(1);
		} else {
			int x = N;
			for (int i=2; i*i<=N; i++) {
				int cnt = 0;
				while (x%i==0) {
					cnt++;
					x/=i;
				}
				if (cnt!=0) {
					list.add(cnt);
				}
			}
			if (x!=1) {
				list.add(1);
			}
		}

		int tmp = 0;
		for (int i=0; i<list.size(); i++) {
			tmp ^= list.get(i);
		}

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

		sc.close();
	}
}
0