結果

問題 No.781 円周上の格子点の数え上げ
ユーザー ratetion
提出日時 2019-01-11 21:54:58
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 353 ms / 2,000 ms
コード長 540 bytes
コンパイル時間 1,496 ms
コンパイル使用メモリ 167,632 KB
実行使用メモリ 81,536 KB
最終ジャッジ日時 2024-11-30 06:05:40
合計ジャッジ時間 9,961 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

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