結果

問題 No.781 円周上の格子点の数え上げ
ユーザー ei1333333ei1333333
提出日時 2019-01-11 21:33:49
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 440 bytes
コンパイル時間 2,569 ms
コンパイル使用メモリ 198,668 KB
実行使用メモリ 42,516 KB
最終ジャッジ日時 2023-08-20 04:27:07
合計ジャッジ時間 5,470 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
42,412 KB
testcase_01 AC 107 ms
42,400 KB
testcase_02 AC 103 ms
42,364 KB
testcase_03 AC 107 ms
42,516 KB
testcase_04 AC 108 ms
42,408 KB
testcase_05 AC 105 ms
42,404 KB
testcase_06 AC 109 ms
42,396 KB
testcase_07 AC 108 ms
42,364 KB
testcase_08 AC 104 ms
42,452 KB
testcase_09 AC 107 ms
42,368 KB
testcase_10 AC 104 ms
42,404 KB
testcase_11 AC 106 ms
42,460 KB
testcase_12 AC 111 ms
42,460 KB
testcase_13 AC 114 ms
42,448 KB
testcase_14 AC 102 ms
42,464 KB
testcase_15 AC 110 ms
42,384 KB
testcase_16 AC 110 ms
42,392 KB
testcase_17 AC 113 ms
42,368 KB
testcase_18 AC 109 ms
42,368 KB
testcase_19 AC 110 ms
42,452 KB
testcase_20 AC 107 ms
42,460 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