結果

問題 No.2 素因数ゲーム
ユーザー driip
提出日時 2020-09-16 15:13:29
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 904 bytes
コンパイル時間 2,280 ms
コンパイル使用メモリ 194,784 KB
最終ジャッジ日時 2025-01-14 15:13:46
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

bool erased[10005];
vector<int> prime;


int main() {
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
    #endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

    for (ll i = 2; i <= 10000; i++) {
        if (!erased[i]) {
            prime.push_back(i);
            for (ll j = i * 2; j <= 10000; j += i) {
                erased[j] = true;
            }
        }
    }

    ll n; cin >> n;

    ll over2cnt = 0;
    for (auto &p : prime) {
        if (n % p == 0) {
            int cnt = 0;
            // cout << p << ' ';
            while (n % p == 0) {
                n /= p;
                cnt++;
            }
            // cout << cnt << '\n';
            if (cnt >= 2) over2cnt++;
        }
    }

    if (over2cnt <= 1) cout << "Alice\n";
    else cout << "Bob\n";

    return 0;
}
0