結果

問題 No.781 円周上の格子点の数え上げ
ユーザー pluto77pluto77
提出日時 2019-01-12 11:31:56
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 343 bytes
コンパイル時間 1,442 ms
コンパイル使用メモリ 143,436 KB
実行使用メモリ 42,688 KB
最終ジャッジ日時 2023-08-22 14:13:55
合計ジャッジ時間 2,731 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 89 ms
42,688 KB
testcase_09 AC 88 ms
42,420 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 94 ms
42,440 KB
testcase_13 AC 99 ms
42,412 KB
testcase_14 AC 4 ms
7,564 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 50 ms
27,936 KB
testcase_18 AC 45 ms
28,116 KB
testcase_19 AC 47 ms
27,952 KB
testcase_20 AC 44 ms
27,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int cnt[10000001];
int main(){
 int x,y;
 cin>>x>>y;
 int a=1;
 while((a+1)*(a+1)<=y){
  a++;
 }
 for(int i=1;i<=a;i++){
  for(int j=0;j<=a;j++){
   if(i*i+j*j<=y)
    cnt[i*i+j*j]++;
  }
 }
 int res=0;
 for(int i=x;i<=y;i++){
  res=max(res,cnt[i]);
 }
 cout<<res*4<<endl;
 return 0;
}
0