結果
| 問題 |
No.103 素因数ゲーム リターンズ
|
| コンテスト | |
| ユーザー |
Ysmr_Ry
|
| 提出日時 | 2014-12-20 14:50:55 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 511 bytes |
| コンパイル時間 | 494 ms |
| コンパイル使用メモリ | 45,184 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-12 02:28:32 |
| 合計ジャッジ時間 | 1,555 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:25:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
25 | scanf( "%d", &N );
| ~~~~~^~~~~~~~~~~~
main.cpp:29:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
29 | scanf( "%d", &M );
| ~~~~~^~~~~~~~~~~~
ソースコード
#include<cstdio>
#include<map>
#define rep(i,a) for(int i=0;i<(a);++i)
int N, M, ans;
std::map<int, int> prime_factor( int n )
{
std::map<int, int> ret;
for( int i = 2; i*i <= n; ++i ) while( n % i == 0 )
{
++ret[i];
n /= i;
}
if( n != 1 )
++ret[n];
return ret;
}
int main()
{
scanf( "%d", &N );
rep( i, N )
{
int M;
scanf( "%d", &M );
auto m = prime_factor( M );
for( auto it = m.begin(); it != m.end(); ++it )
ans ^= it->second%3;
}
puts( ans?"Alice":"Bob" );
return 0;
}
Ysmr_Ry