結果

問題 No.781 円周上の格子点の数え上げ
ユーザー ei1333333ei1333333
提出日時 2019-01-11 21:33:49
言語 C++17
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 440 bytes
コンパイル時間 1,710 ms
使用メモリ 42,580 KB
最終ジャッジ日時 2023-01-06 09:39:22
合計ジャッジ時間 5,523 ms
ジャッジサーバーID
(参考情報)
judge16 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 107 ms
42,424 KB
testcase_01 AC 113 ms
42,424 KB
testcase_02 AC 116 ms
42,428 KB
testcase_03 AC 119 ms
42,548 KB
testcase_04 AC 114 ms
42,520 KB
testcase_05 AC 119 ms
42,424 KB
testcase_06 AC 112 ms
42,492 KB
testcase_07 AC 113 ms
42,476 KB
testcase_08 AC 112 ms
42,556 KB
testcase_09 AC 113 ms
42,480 KB
testcase_10 AC 117 ms
42,432 KB
testcase_11 AC 113 ms
42,492 KB
testcase_12 AC 117 ms
42,532 KB
testcase_13 AC 126 ms
42,580 KB
testcase_14 AC 115 ms
42,428 KB
testcase_15 AC 118 ms
42,428 KB
testcase_16 AC 120 ms
42,524 KB
testcase_17 AC 122 ms
42,544 KB
testcase_18 AC 118 ms
42,544 KB
testcase_19 AC 117 ms
42,568 KB
testcase_20 AC 117 ms
42,500 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