結果

問題 No.103 素因数ゲーム リターンズ
ユーザー Grenache
提出日時 2016-05-19 19:51:25
言語 Java
(openjdk 23)
結果
AC  
実行時間 141 ms / 5,000 ms
コード長 700 bytes
コンパイル時間 3,992 ms
コンパイル使用メモリ 74,456 KB
実行使用メモリ 54,180 KB
最終ジャッジ日時 2024-10-06 10:20:44
合計ジャッジ時間 7,658 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;


public class Main_yukicoder103 {

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

        int n = sc.nextInt();

        int ret = 0;
        for (int i = 0; i < n; i++) {
        	int m = sc.nextInt();
        	int tmp = m;
        	for (int j = 2; j * j <= m; j++) {
        		int cnt = 0;
        		while (tmp % j == 0) {
        			cnt++;
        			tmp /= j;
        		}

        		ret ^= cnt % 3;
        	}
        	if (tmp != 1) {
        		ret ^= 1;
        	}
        }

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

        sc.close();
    }
}
0