結果

問題 No.781 円周上の格子点の数え上げ
ユーザー MineMine
提出日時 2020-09-15 13:58:02
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 130 ms / 2,000 ms
コード長 426 bytes
コンパイル時間 1,549 ms
コンパイル使用メモリ 166,264 KB
実行使用メモリ 42,472 KB
最終ジャッジ日時 2023-09-04 01:40:55
合計ジャッジ時間 5,200 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
42,136 KB
testcase_01 AC 116 ms
42,164 KB
testcase_02 AC 116 ms
42,252 KB
testcase_03 AC 115 ms
42,252 KB
testcase_04 AC 115 ms
42,188 KB
testcase_05 AC 113 ms
42,260 KB
testcase_06 AC 112 ms
42,180 KB
testcase_07 AC 116 ms
42,328 KB
testcase_08 AC 112 ms
42,268 KB
testcase_09 AC 115 ms
42,268 KB
testcase_10 AC 115 ms
42,184 KB
testcase_11 AC 116 ms
42,472 KB
testcase_12 AC 121 ms
42,120 KB
testcase_13 AC 130 ms
42,264 KB
testcase_14 AC 115 ms
42,228 KB
testcase_15 AC 117 ms
42,184 KB
testcase_16 AC 115 ms
42,324 KB
testcase_17 AC 121 ms
42,180 KB
testcase_18 AC 114 ms
42,144 KB
testcase_19 AC 116 ms
42,260 KB
testcase_20 AC 117 ms
42,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  long x, y;
  cin >> x >> y;

  vector<int> v;
  v.assign(pow(10, 7) + 1, 0);

  for (int a = 0; a < 3164; a++) {
    for (int b = 1; b < 3164; b++) {
      if (a * a + b * b > pow(10, 7)) {
        break;
      }
      v.at(a * a + b * b) += 1;
    }
  }

  int ans = 0;
  for (int i = x; i < y+1; i++){
    ans = max(ans, v.at(i)*4);
  }
  cout << ans << endl;
}
0