結果

問題 No.781 円周上の格子点の数え上げ
ユーザー ei1333333ei1333333
提出日時 2019-01-11 21:33:49
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 109 ms / 2,000 ms
コード長 440 bytes
コンパイル時間 1,763 ms
コンパイル使用メモリ 199,536 KB
実行使用メモリ 42,576 KB
最終ジャッジ日時 2024-05-07 11:58:02
合計ジャッジ時間 5,106 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
42,496 KB
testcase_01 AC 99 ms
42,496 KB
testcase_02 AC 95 ms
42,496 KB
testcase_03 AC 95 ms
42,368 KB
testcase_04 AC 98 ms
42,496 KB
testcase_05 AC 98 ms
42,368 KB
testcase_06 AC 101 ms
42,488 KB
testcase_07 AC 91 ms
42,368 KB
testcase_08 AC 97 ms
42,496 KB
testcase_09 AC 92 ms
42,496 KB
testcase_10 AC 101 ms
42,496 KB
testcase_11 AC 96 ms
42,496 KB
testcase_12 AC 100 ms
42,368 KB
testcase_13 AC 109 ms
42,576 KB
testcase_14 AC 97 ms
42,496 KB
testcase_15 AC 100 ms
42,496 KB
testcase_16 AC 101 ms
42,368 KB
testcase_17 AC 105 ms
42,352 KB
testcase_18 AC 94 ms
42,448 KB
testcase_19 AC 100 ms
42,496 KB
testcase_20 AC 95 ms
42,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;

using int64 = long long;

int main() {
  // x^2+y^2 = √R
  // (x^2+y^2)^2 = R^2
  int mp[10000001] = {};
  for(int64 x = 0; x * x <= 10000000; x++) {
    for(int64 y = 1; (x * x + y * y) <= 10000000; y++) {
      int64 v = (x * x + y * y);
      mp[v]++;
    }
  }
  int X, Y;
  cin >> X >> Y;
  int ret = 0;
  for(int i = X; i <= Y; i++) ret = max(ret, mp[i]);
  cout << ret * 4 << endl;
}
0