結果

問題 No.781 円周上の格子点の数え上げ
ユーザー eQeeQe
提出日時 2020-05-13 02:16:10
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 183 ms / 2,000 ms
コード長 817 bytes
コンパイル時間 1,797 ms
コンパイル使用メモリ 143,768 KB
実行使用メモリ 82,544 KB
最終ジャッジ日時 2023-10-12 06:53:37
合計ジャッジ時間 6,079 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 143 ms
82,416 KB
testcase_01 AC 183 ms
82,332 KB
testcase_02 AC 140 ms
82,268 KB
testcase_03 AC 139 ms
82,220 KB
testcase_04 AC 141 ms
82,208 KB
testcase_05 AC 140 ms
82,420 KB
testcase_06 AC 141 ms
82,312 KB
testcase_07 AC 140 ms
82,292 KB
testcase_08 AC 139 ms
82,420 KB
testcase_09 AC 139 ms
82,328 KB
testcase_10 AC 138 ms
82,220 KB
testcase_11 AC 138 ms
82,284 KB
testcase_12 AC 144 ms
82,272 KB
testcase_13 AC 149 ms
82,404 KB
testcase_14 AC 139 ms
82,284 KB
testcase_15 AC 140 ms
82,328 KB
testcase_16 AC 141 ms
82,212 KB
testcase_17 AC 148 ms
82,416 KB
testcase_18 AC 142 ms
82,544 KB
testcase_19 AC 141 ms
82,228 KB
testcase_20 AC 140 ms
82,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <string>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define moca(a, s, b) a=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
template<class T>bool chmax(T &a, const T &b) {if(a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if(b<a) {a=b; return 1;} return 0;}
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;

/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/


ll cnt[MAX*100]={};
int main(void) {
  ll i, j, k;
  
  ll X, Y;
  cin >> X >> Y;
  
  
  for(i=0; i<=sqrt(MAX*100); i++) {
    for(j=1; j<=sqrt(MAX*100); j++) {
      ll a=i*i+j*j;
      if(a<MAX*100) cnt[a]+=4;
    }
  }
  
  ll ans=0;
  for(i=X; i<=Y; i++) chmax(ans, cnt[i]);
  pt(ans);
  
}
 
 
0