結果
| 問題 | No.2 素因数ゲーム |
| コンテスト | |
| ユーザー |
AreTrash
|
| 提出日時 | 2016-04-13 13:52:36 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 16 ms / 5,000 ms |
| コード長 | 997 bytes |
| 記録 | |
| コンパイル時間 | 599 ms |
| コンパイル使用メモリ | 104,832 KB |
| 実行使用メモリ | 18,432 KB |
| 最終ジャッジ日時 | 2026-06-01 09:41:15 |
| 合計ジャッジ時間 | 2,409 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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");
}
}
}
AreTrash