結果

問題 No.781 円周上の格子点の数え上げ
ユーザー ratetionratetion
提出日時 2019-01-11 21:54:58
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 353 ms / 2,000 ms
コード長 540 bytes
コンパイル時間 3,090 ms
コンパイル使用メモリ 164,668 KB
実行使用メモリ 81,416 KB
最終ジャッジ日時 2023-08-20 05:48:23
合計ジャッジ時間 11,626 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 336 ms
81,416 KB
testcase_01 AC 329 ms
81,136 KB
testcase_02 AC 337 ms
81,324 KB
testcase_03 AC 334 ms
81,284 KB
testcase_04 AC 332 ms
81,152 KB
testcase_05 AC 343 ms
81,136 KB
testcase_06 AC 336 ms
81,228 KB
testcase_07 AC 335 ms
81,144 KB
testcase_08 AC 344 ms
81,084 KB
testcase_09 AC 342 ms
81,232 KB
testcase_10 AC 339 ms
81,124 KB
testcase_11 AC 342 ms
81,152 KB
testcase_12 AC 352 ms
81,152 KB
testcase_13 AC 353 ms
81,144 KB
testcase_14 AC 342 ms
81,140 KB
testcase_15 AC 341 ms
81,152 KB
testcase_16 AC 335 ms
81,224 KB
testcase_17 AC 347 ms
81,084 KB
testcase_18 AC 335 ms
81,088 KB
testcase_19 AC 338 ms
81,208 KB
testcase_20 AC 332 ms
81,096 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