結果

問題 No.550 夏休みの思い出(1)
ユーザー ei1333333
提出日時 2017-07-29 00:34:58
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,711 ms / 2,000 ms
コード長 707 bytes
コンパイル時間 1,946 ms
コンパイル使用メモリ 170,176 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-10 11:14:17
合計ジャッジ時間 46,553 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 55
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:44:10: warning: use of an operand of type 'bool' in 'operator++' is deprecated [-Wdeprecated]
   44 |       if(flag++) cout << " ";
      |          ^~~~

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long int64;

int main()
{
  int64 A, B, C;
  cin >> A >> B >> C;

  bool flag = false;

  auto f = [&](int64 x)
  {
    return (((x + A) * x + B) * x + C);
  };

  auto g = [&](__int128 x)
  {
    return (((x + A) * x + B) * x + C);
  };

  vector< int64 > vs;

  for(int64 X = -10000000; X < 10000000; X++) {
    if(g(X) == 0) {
      vs.push_back(X);
    }
  }

  if(vs.size() == 3) {
    for(int i = 0; i < vs.size(); i++) {
      if(i) cout << " ";
      cout << vs[i];
    }
    return (0);
  }

  vs.clear();

  for(int64 X = -1000000000; X < 1000000000; X++) {
    if(f(X) == 0) {
      if(flag++) cout << " ";
      cout << X;
    }
  }
}
0