結果

問題 No.781 円周上の格子点の数え上げ
ユーザー 37zigen37zigen
提出日時 2019-01-11 22:56:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 164 ms / 2,000 ms
コード長 540 bytes
コンパイル時間 1,498 ms
コンパイル使用メモリ 164,340 KB
実行使用メモリ 81,800 KB
最終ジャッジ日時 2023-08-20 11:40:28
合計ジャッジ時間 3,410 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
81,484 KB
testcase_01 AC 31 ms
81,540 KB
testcase_02 AC 31 ms
81,800 KB
testcase_03 AC 31 ms
81,476 KB
testcase_04 AC 30 ms
81,484 KB
testcase_05 AC 30 ms
81,520 KB
testcase_06 AC 30 ms
81,540 KB
testcase_07 AC 30 ms
81,540 KB
testcase_08 AC 30 ms
81,580 KB
testcase_09 AC 30 ms
81,612 KB
testcase_10 AC 31 ms
81,764 KB
testcase_11 AC 31 ms
81,480 KB
testcase_12 AC 101 ms
81,552 KB
testcase_13 AC 164 ms
81,548 KB
testcase_14 AC 31 ms
81,480 KB
testcase_15 AC 31 ms
81,484 KB
testcase_16 AC 31 ms
81,476 KB
testcase_17 AC 102 ms
81,480 KB
testcase_18 AC 30 ms
81,484 KB
testcase_19 AC 31 ms
81,552 KB
testcase_20 AC 31 ms
81,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

long long cnt[10000001];

int main(){
  long long X;
  long long Y;
  std::cin>>X>>Y;
  long long a[3162];
  for(long long i=0;i*i<=Y;++i){
    a[i]=i*i;
  }
  for(int i=0;i<10000001;++i){
    cnt[i]=0;
  }
  for(long long i=0;i<=3162;++i){
    for(long long j=0;j<=3162;++j){
      if(X<=i*i+j*j&&i*i+j*j<=Y){
	int add=1;
	if(i>0)add*=2;
	if(j>0)add*=2;
	cnt[i*i+j*j]+=add;
      }
    }
  }
  long long ans=0;
  for(int i=X;i<=Y;++i){
    ans=std::max(ans,cnt[i]);
  }
  std::cout<<ans<<std::endl;
  return 0;
}
0