結果
問題 |
No.550 夏休みの思い出(1)
|
ユーザー |
|
提出日時 | 2017-07-28 23:52:47 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 712 bytes |
コンパイル時間 | 936 ms |
コンパイル使用メモリ | 78,576 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-11 05:33:14 |
合計ジャッジ時間 | 2,665 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 55 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #include <string> #include <set> int main() { long long a, b, c; std::cin >> a >> b >> c; constexpr int MOD = 33331; std::set<long long> ans; for (__int128 i = 0; i < MOD; i++) { if ((i * i * i + a * i * i + b * i + c) % MOD == 0) { for (__int128 j = i; j <= 1000000000; j += MOD) { if (j * j * j + a * j * j + b * j + c == 0) ans.insert(j); } for (long long j = i; j >= -1000000000; j -= MOD) { if (j * j * j + a * j * j + b * j + c == 0) ans.insert(j); } } } for (long long x : ans) { std::cout << x << ' '; } }