結果
| 問題 |
No.2751 429-like Number
|
| コンテスト | |
| ユーザー |
Today03
|
| 提出日時 | 2024-05-17 08:14:02 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 667 bytes |
| コンパイル時間 | 1,935 ms |
| コンパイル使用メモリ | 200,156 KB |
| 最終ジャッジ日時 | 2025-02-21 14:22:27 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 1 TLE * 1 -- * 20 |
コンパイルメッセージ
main.cpp: In function ‘std::vector<long long int> factors(ll)’:
main.cpp:11:10: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | fgets(buf, 1024, fp);
| ~~~~~^~~~~~~~~~~~~~~
ソースコード
#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";
}
}
}
Today03