結果
| 問題 | No.2 素因数ゲーム | 
| コンテスト | |
| ユーザー |  AreTrash | 
| 提出日時 | 2016-04-13 13:52:36 | 
| 言語 | C#(csc) (csc 3.9.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 28 ms / 5,000 ms | 
| コード長 | 997 bytes | 
| コンパイル時間 | 1,098 ms | 
| コンパイル使用メモリ | 112,012 KB | 
| 実行使用メモリ | 17,792 KB | 
| 最終ジャッジ日時 | 2024-12-26 12:27:55 | 
| 合計ジャッジ時間 | 3,035 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 31 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
namespace No2_1{
    public class Program{
        public static void Main(string[] args){
            var n = int.Parse(Console.ReadLine());
            var tmp = n;
            var cnt = 0;
            var expList = new List<int>();
            while(tmp % 2 == 0){
                tmp /= 2;
                cnt++;
            }
            if(cnt != 0){
                expList.Add(cnt);
                cnt = 0;
            }
            for(var i = 3; i * i <= n; i += 2){
                while(tmp % i == 0){
                    tmp /= i;
                    cnt++;
                }
                if(cnt != 0){
                    expList.Add(cnt);
                    cnt = 0;
                }
            }
            if(tmp > 1) expList.Add(1);
            var nim = 0;
            foreach(var exp in expList){
                nim ^= exp;
            }
            Console.WriteLine(nim == 0 ? "Bob" : "Alice");
        }
    }
}
            
            
            
        