結果

問題 No.2751 429-like Number
コンテスト
ユーザー Today03
提出日時 2024-05-17 08:14:02
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 667 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,220 ms
コンパイル使用メモリ 216,304 KB
実行使用メモリ 11,908 KB
最終ジャッジ日時 2026-07-04 18:09:29
合計ジャッジ時間 7,277 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 1 TLE * 1 -- * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9 + 10;
const ll INFL = 4e18;

vector<ll> factors(ll x) {
    vector<ll> fs;
    FILE* fp = popen(("factor " + to_string(x)).c_str(), "r");
    char buf[1024];
    fgets(buf, 1024, fp);
    pclose(fp);
    string s = buf;
    s = s.substr(s.find(":") + 1);
    stringstream ss(s);
    ll f;
    while (ss >> f) {
        fs.push_back(f);
    }
    return fs;
}

int main() {
    int Q;
    cin >> Q;

    while (Q--) {
        ll A;
        cin >> A;

        if (factors(A).size() == 3) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }
}
0