結果

問題 No.550 夏休みの思い出(1)
ユーザー ei1333333
提出日時 2017-07-28 23:32:52
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 756 bytes
コンパイル時間 1,684 ms
コンパイル使用メモリ 172,756 KB
実行使用メモリ 13,696 KB
最終ジャッジ日時 2024-10-10 05:20:30
合計ジャッジ時間 8,019 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other TLE * 1 -- * 54
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:41:8: warning: use of an operand of type 'bool' in 'operator++' is deprecated [-Wdeprecated]
   41 |     if(first++) cout << " ";
      |        ^~~~~

ソースコード

diff #

#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++) {
        if(mod % j == 0) {
          vs.emplace(i);
          vs.emplace(j);
          vs.emplace(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;
}

0