結果

問題 No.2 素因数ゲーム
ユーザー CrazyBBBCrazyBBB
提出日時 2016-03-05 18:55:05
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 808 bytes
コンパイル時間 4,941 ms
コンパイル使用メモリ 85,732 KB
実行使用メモリ 57,892 KB
最終ジャッジ日時 2023-10-24 19:56:35
合計ジャッジ時間 9,729 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
56,232 KB
testcase_01 AC 112 ms
54,220 KB
testcase_02 AC 125 ms
57,256 KB
testcase_03 AC 126 ms
57,556 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 122 ms
57,532 KB
testcase_08 WA -
testcase_09 AC 126 ms
57,592 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 122 ms
57,584 KB
testcase_13 AC 122 ms
57,188 KB
testcase_14 AC 126 ms
57,152 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 128 ms
57,228 KB
testcase_18 AC 130 ms
57,516 KB
testcase_19 AC 127 ms
57,372 KB
testcase_20 WA -
testcase_21 AC 124 ms
57,172 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 130 ms
57,680 KB
testcase_27 AC 116 ms
57,288 KB
testcase_28 WA -
testcase_29 AC 121 ms
57,216 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

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 {
			for (int i=2; i*i<=N; i++) {
				int cnt = 0;
				while (N%i==0) {
					cnt++;
					N/=i;
				}
				if (cnt!=0) list.add(cnt);
			}
			if (list.isEmpty()) {
				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