結果

問題 No.2 素因数ゲーム
ユーザー Rumain831
提出日時 2025-05-03 01:05:19
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 583 bytes
コンパイル時間 1,040 ms
コンパイル使用メモリ 77,064 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-05-03 01:05:22
合計ジャッジ時間 2,264 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(void){
  int n; cin >> n;
  vector<int> yakusu(1e4+1, -1);
  int copy=n;
  vector<int> ps;
  for(int i=2; i*i<=n; i++){
    if(yakusu[i]==-1) yakusu[i]=i;
    else continue;
    int cnt=0;
    while(copy%i==0) cnt++, copy/=i;
    if(cnt) ps.push_back(cnt);
    int co=i;
    while(co<=1e4){
      if(yakusu[co]==-1) yakusu[co]=i;
      co+=i;
    }
  }
  if(copy>1) ps.push_back(1);
  int xo=0;
  for(auto p:ps) xo^=p;
  if(xo) cout << "Alice" << endl;
  else cout << "Bob" << endl;
  return 0;
}
0