結果

問題 No.781 円周上の格子点の数え上げ
ユーザー m-44m-44
提出日時 2019-09-15 19:36:52
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 382 bytes
コンパイル時間 1,534 ms
コンパイル使用メモリ 164,012 KB
実行使用メモリ 42,452 KB
最終ジャッジ日時 2023-09-21 04:11:37
合計ジャッジ時間 3,322 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 114 ms
42,384 KB
testcase_09 AC 113 ms
42,324 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 130 ms
42,324 KB
testcase_13 AC 135 ms
42,452 KB
testcase_14 AC 5 ms
7,480 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 74 ms
28,000 KB
testcase_18 AC 69 ms
27,968 KB
testcase_19 AC 69 ms
28,028 KB
testcase_20 AC 71 ms
27,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int cnt[(int)1e7+1];
int main() {
  int x, y;
  cin>>x>>y;

  for (int i=0; i<=y; i++) cnt[i] = 0;
  for (int i=0; i<=sqrt(y); i++) {
    for (int j=1; j<=sqrt(y); j++) {
      if (i*i + j*j > y) break;
      ++cnt[i*i + j*j];
    }
  }
  int ans = 0;
  for (int i=x; i<=y; i++) {
    ans = max(cnt[i], ans);
  }
  cout<<4*ans<<endl;
}
0