結果

問題 No.103 素因数ゲーム リターンズ
ユーザー kuuso1kuuso1
提出日時 2014-12-14 23:54:30
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 62 ms / 5,000 ms
コード長 1,409 bytes
コンパイル時間 2,372 ms
コンパイル使用メモリ 104,376 KB
実行使用メモリ 22,812 KB
最終ジャッジ日時 2023-09-02 14:33:48
合計ジャッジ時間 4,967 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
20,720 KB
testcase_01 AC 59 ms
20,548 KB
testcase_02 AC 59 ms
22,596 KB
testcase_03 AC 61 ms
18,684 KB
testcase_04 AC 59 ms
20,696 KB
testcase_05 AC 61 ms
20,776 KB
testcase_06 AC 61 ms
20,632 KB
testcase_07 AC 59 ms
20,612 KB
testcase_08 AC 59 ms
20,624 KB
testcase_09 AC 59 ms
22,780 KB
testcase_10 AC 58 ms
20,796 KB
testcase_11 AC 60 ms
20,708 KB
testcase_12 AC 60 ms
20,628 KB
testcase_13 AC 59 ms
22,640 KB
testcase_14 AC 60 ms
20,784 KB
testcase_15 AC 59 ms
22,812 KB
testcase_16 AC 60 ms
22,808 KB
testcase_17 AC 62 ms
20,868 KB
testcase_18 AC 60 ms
20,620 KB
testcase_19 AC 60 ms
22,796 KB
testcase_20 AC 60 ms
22,724 KB
testcase_21 AC 59 ms
20,692 KB
testcase_22 AC 59 ms
20,676 KB
testcase_23 AC 61 ms
20,748 KB
testcase_24 AC 60 ms
20,740 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
 
class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int x=0;
		for(int i=0;i<N;i++){
			Dictionary<int,int> D=PrimDec(A[i]);
			foreach(int k in D.Keys){
				x^=D[k]%3;
			}
		}
		Console.WriteLine(x==0?"Bob":"Alice");
		
	}
	int N;
	int[] A;
	public Sol(){
		N=ri();
		A=ria();
	}


	static Dictionary<int,int> PrimDec(int A){
	 	Dictionary<int,int> D=new Dictionary<int,int>();
	 	if(A==1)return null;
	 	int rem=A;
	 	for(int i=2;i<=(int)Math.Sqrt((double)A);i++){
	 		if(rem%i==0){
	 			int cnt=0;
	 			while(rem%i==0){cnt++;rem/=i;}
	 			D.Add(i,cnt);
	 		}
	 		if(rem==1)break;
	 	}
	 	if(rem!=1)D.Add(rem,1);
	 	return D;
	}


	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}
0