結果
問題 |
No.550 夏休みの思い出(1)
|
ユーザー |
![]() |
提出日時 | 2017-07-28 23:35:34 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 794 bytes |
コンパイル時間 | 1,799 ms |
コンパイル使用メモリ | 172,940 KB |
実行使用メモリ | 13,696 KB |
最終ジャッジ日時 | 2024-10-10 05:28:19 |
合計ジャッジ時間 | 8,342 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | TLE * 1 -- * 54 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:42:8: warning: use of an operand of type 'bool' in 'operator++' is deprecated [-Wdeprecated] 42 | if(first++) cout << " "; | ^~~~~
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long int64; int main() { int64 A, B, C; cin >> A >> B >> C; auto f = [&](auto x) { return (x * x * x + A * x * x + B * x + C); }; set< int64 > vs; int64 st = llabs(C); for(int64 i = 1; i * i * i <= st; i++) { if(st % i == 0) { int64 mod = st / i; for(int64 j = i + 1; j * j <= mod && j < 1000000000; j++) { if(mod % j == 0) { vs.emplace(i); vs.emplace(j); vs.emplace(mod / j); mod /= j; } } } } set< int64 > ans; for(auto &s : vs) { if(f(s) == 0) ans.emplace(s); if(f(-s) == 0) ans.emplace(-s); } bool first = false; for(auto &s : ans) { if(first++) cout << " "; cout << s; } cout << endl; }