結果
問題 | No.2 素因数ゲーム |
ユーザー |
![]() |
提出日時 | 2014-12-01 19:48:50 |
言語 | C++11 (gcc 13.3.0) |
結果 |
MLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 664 bytes |
コンパイル時間 | 421 ms |
コンパイル使用メモリ | 60,120 KB |
実行使用メモリ | 817,104 KB |
最終ジャッジ日時 | 2024-06-11 07:35:39 |
合計ジャッジ時間 | 5,050 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 MLE * 3 -- * 9 |
ソースコード
#include <iostream> #include <vector> using namespace std; struct Stones { int label; int count; Stones(int l) : label(l) , count(0) { } Stones(int l, int c) : label(l) , count(c) { } }; int main() { int n; cin >> n; vector<Stones> stones; for (int i = 2; i <= n; ++i) { Stones s(i); while (n % i == 0) { ++s.count; n /= i; } stones.push_back(s); } int nim = 0; int size = stones.size(); for (int i = 0; i < size; ++i) { nim ^= stones[i].count; } if (nim == 0) { cout << "Bob" << endl; } else { cout << "Alice" << endl; } return 0; }