結果

問題 No.781 円周上の格子点の数え上げ
ユーザー kk
提出日時 2020-07-19 04:16:27
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 161 ms / 2,000 ms
コード長 559 bytes
コンパイル時間 1,902 ms
コンパイル使用メモリ 200,760 KB
実行使用メモリ 42,720 KB
最終ジャッジ日時 2023-08-21 17:57:01
合計ジャッジ時間 6,314 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 149 ms
42,448 KB
testcase_01 AC 147 ms
42,496 KB
testcase_02 AC 145 ms
42,676 KB
testcase_03 AC 152 ms
42,472 KB
testcase_04 AC 156 ms
42,476 KB
testcase_05 AC 150 ms
42,464 KB
testcase_06 AC 149 ms
42,504 KB
testcase_07 AC 152 ms
42,456 KB
testcase_08 AC 149 ms
42,468 KB
testcase_09 AC 149 ms
42,492 KB
testcase_10 AC 148 ms
42,472 KB
testcase_11 AC 152 ms
42,720 KB
testcase_12 AC 150 ms
42,556 KB
testcase_13 AC 156 ms
42,716 KB
testcase_14 AC 150 ms
42,440 KB
testcase_15 AC 154 ms
42,444 KB
testcase_16 AC 155 ms
42,448 KB
testcase_17 AC 161 ms
42,468 KB
testcase_18 AC 151 ms
42,576 KB
testcase_19 AC 145 ms
42,496 KB
testcase_20 AC 147 ms
42,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)

const int MAXN = 1e7;
int f[MAXN+1];

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  vector<int> sq;
  for (int i = 0; i * i <= MAXN; i++)
    sq.push_back(i * i);

  int n = sq.size();
  REP (i, n) REP (j, n) {
    if (sq[i] + sq[j] <= MAXN)
      f[sq[i] + sq[j]] += 1 << (sq[i] > 0) + (sq[j] > 0);
  }
  int x, y;
  cin >> x >> y;

  int ret = 0;
  for (int i = x; i <= y; i++)
    ret = max(ret, f[i]);

  cout << ret << endl;
  
  return 0;
}
0