結果

問題 No.2 素因数ゲーム
ユーザー CrazyBBBCrazyBBB
提出日時 2016-03-05 19:05:05
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 804 bytes
コンパイル時間 2,178 ms
コンパイル使用メモリ 78,488 KB
実行使用メモリ 57,824 KB
最終ジャッジ日時 2023-10-24 19:57:07
合計ジャッジ時間 6,885 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
57,188 KB
testcase_01 AC 122 ms
57,472 KB
testcase_02 AC 122 ms
57,576 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 125 ms
57,476 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 124 ms
57,172 KB
testcase_12 AC 128 ms
57,472 KB
testcase_13 AC 128 ms
57,176 KB
testcase_14 AC 126 ms
57,212 KB
testcase_15 WA -
testcase_16 AC 127 ms
57,224 KB
testcase_17 AC 129 ms
57,104 KB
testcase_18 AC 127 ms
57,524 KB
testcase_19 AC 125 ms
57,512 KB
testcase_20 WA -
testcase_21 AC 128 ms
57,528 KB
testcase_22 AC 127 ms
57,472 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 124 ms
57,208 KB
testcase_26 AC 124 ms
57,472 KB
testcase_27 AC 129 ms
57,380 KB
testcase_28 WA -
testcase_29 AC 123 ms
57,156 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 {
			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);
				}
			}
			list.add(x);
		}

		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