結果

問題 No.2 素因数ゲーム
ユーザー jp_ste
提出日時 2016-03-04 12:02:22
言語 Java
(openjdk 23)
結果
AC  
実行時間 142 ms / 5,000 ms
コード長 642 bytes
コンパイル時間 6,391 ms
コンパイル使用メモリ 74,368 KB
実行使用メモリ 41,332 KB
最終ジャッジ日時 2024-12-26 12:21:43
合計ジャッジ時間 9,342 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner scan = new Scanner(System.in)) {
            int N = scan.nextInt();
            int ans = 0;
            for(int i=2; i<=Math.sqrt(N); i++) {
                if(N % i == 0) {
                    int count = 0;
                    while(N % i == 0) {
                        N /= i;
                        count++;
                    }
                    ans ^= count;
                }
            }
            if(N > 1) ans ^= 1;
            
            System.out.println(ans==0? "Bob":"Alice");
        }        
    }
}
0