結果

問題 No.2 素因数ゲーム
ユーザー spaciaspacia
提出日時 2016-01-04 08:01:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 243 ms / 5,000 ms
コード長 780 bytes
コンパイル時間 4,474 ms
コンパイル使用メモリ 72,388 KB
実行使用メモリ 50,620 KB
最終ジャッジ日時 2023-08-27 04:12:13
合計ジャッジ時間 5,473 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
49,168 KB
testcase_01 AC 43 ms
49,316 KB
testcase_02 AC 42 ms
49,648 KB
testcase_03 AC 44 ms
49,304 KB
testcase_04 AC 44 ms
49,236 KB
testcase_05 AC 43 ms
49,348 KB
testcase_06 AC 43 ms
49,320 KB
testcase_07 AC 43 ms
49,460 KB
testcase_08 AC 61 ms
48,488 KB
testcase_09 AC 43 ms
49,340 KB
testcase_10 AC 44 ms
49,864 KB
testcase_11 AC 44 ms
49,320 KB
testcase_12 AC 43 ms
49,456 KB
testcase_13 AC 44 ms
49,276 KB
testcase_14 AC 44 ms
49,228 KB
testcase_15 AC 44 ms
49,232 KB
testcase_16 AC 44 ms
49,632 KB
testcase_17 AC 50 ms
49,972 KB
testcase_18 AC 42 ms
49,696 KB
testcase_19 AC 160 ms
50,528 KB
testcase_20 AC 125 ms
50,364 KB
testcase_21 AC 243 ms
50,620 KB
testcase_22 AC 62 ms
50,516 KB
testcase_23 AC 45 ms
49,336 KB
testcase_24 AC 45 ms
49,212 KB
testcase_25 AC 60 ms
50,572 KB
testcase_26 AC 43 ms
49,828 KB
testcase_27 AC 44 ms
49,284 KB
testcase_28 AC 44 ms
49,148 KB
testcase_29 AC 43 ms
49,220 KB
testcase_30 AC 44 ms
49,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.math.*;

class Main {
	
	public static void out (Object o) {
		System.out.println(o);
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		
		ArrayList<Integer> list = new ArrayList<Integer>();
		
		int cnt = 0;
		if (n % 2 == 0) {
			while (n % 2 == 0) {
				n /= 2;
				cnt++;
			}
			list.add(cnt);
		}
		
		for (int i = 3; i <= n; i += 2) {
			cnt = 0;
			if (n % i == 0) {
				while (n % i == 0) {
					n /= i;
					cnt++;
				}
				list.add(cnt);
			}
		}
		
		int ans = 0;
		for (int i = 0; i < list.size(); i++)
			ans ^= list.get(i);
		
		out(ans == 0 ? "Bob" : "Alice");
		
	}
}
0