結果

問題 No.781 円周上の格子点の数え上げ
ユーザー CleyLCleyL
提出日時 2023-03-28 15:25:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 130 ms / 2,000 ms
コード長 328 bytes
コンパイル時間 626 ms
コンパイル使用メモリ 73,708 KB
実行使用メモリ 42,624 KB
最終ジャッジ日時 2023-10-20 09:43:15
合計ジャッジ時間 2,018 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
4,348 KB
testcase_01 AC 14 ms
4,348 KB
testcase_02 AC 14 ms
4,348 KB
testcase_03 AC 15 ms
4,348 KB
testcase_04 AC 14 ms
4,348 KB
testcase_05 AC 14 ms
4,348 KB
testcase_06 AC 14 ms
4,348 KB
testcase_07 AC 14 ms
4,348 KB
testcase_08 AC 14 ms
4,348 KB
testcase_09 AC 14 ms
4,348 KB
testcase_10 AC 15 ms
4,348 KB
testcase_11 AC 14 ms
4,348 KB
testcase_12 AC 73 ms
25,572 KB
testcase_13 AC 130 ms
42,624 KB
testcase_14 AC 15 ms
5,612 KB
testcase_15 AC 14 ms
4,348 KB
testcase_16 AC 14 ms
4,348 KB
testcase_17 AC 69 ms
26,760 KB
testcase_18 AC 15 ms
5,612 KB
testcase_19 AC 15 ms
5,612 KB
testcase_20 AC 15 ms
5,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
using namespace std;
int A[10000010];
int main(){
  int x,y;cin>>x>>y;
  for(int i = 1; 4000 > i; i++){
    for(int j = 0; 4000 > j; j++){
      if(x <= i*i+j*j && i*i+j*j <= y)A[i*i+j*j]++;
    }
  }
  int ans = 0;
  for(int i = x; y >= i; i++)ans = max(ans,A[i]);
  cout << ans*4 << endl;
}
0