結果

問題 No.781 円周上の格子点の数え上げ
ユーザー ratetionratetion
提出日時 2019-01-11 21:54:58
言語 C++14
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 379 ms / 2,000 ms
コード長 540 bytes
コンパイル時間 1,425 ms
使用メモリ 81,444 KB
最終ジャッジ日時 2023-01-06 11:13:46
合計ジャッジ時間 10,819 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 369 ms
81,332 KB
testcase_01 AC 368 ms
81,408 KB
testcase_02 AC 368 ms
81,296 KB
testcase_03 AC 370 ms
81,160 KB
testcase_04 AC 366 ms
81,296 KB
testcase_05 AC 360 ms
81,408 KB
testcase_06 AC 373 ms
81,412 KB
testcase_07 AC 367 ms
81,236 KB
testcase_08 AC 368 ms
81,144 KB
testcase_09 AC 362 ms
81,440 KB
testcase_10 AC 366 ms
81,156 KB
testcase_11 AC 366 ms
81,364 KB
testcase_12 AC 374 ms
81,160 KB
testcase_13 AC 379 ms
81,296 KB
testcase_14 AC 370 ms
81,240 KB
testcase_15 AC 369 ms
81,156 KB
testcase_16 AC 358 ms
81,444 KB
testcase_17 AC 369 ms
81,436 KB
testcase_18 AC 360 ms
81,240 KB
testcase_19 AC 356 ms
81,364 KB
testcase_20 AC 351 ms
81,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define int long long
#define endl '\n'
int mod=1e9+7;

signed main(){
  double x,y;
  cin>>x>>y;
  //x=sqrt(x);
  //y=sqrt(y);
  //x=ceil(x);
  //y=ceil(y);
  int maxn=sqrt(1e7);
  vector<int> ans(1e7+1,0);
  for(double i=-1*maxn;i<=maxn;i++){
    for(double j=-1*maxn;j<=maxn;j++){
      double tmp=i*i+j*j;
      if(tmp<=1e7)ans[tmp]++;
    }
  }
  if(x==y){
    cout<<ans[x]<<endl;
    return 0;
  }
  int ansnum=0;
  for(int i=x;i<=y;i++)ansnum=max(ansnum,ans[i]);
  cout<<ansnum<<endl;
}
0