結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 187 ms
82,328 KB
testcase_01 AC 152 ms
82,520 KB
testcase_02 AC 150 ms
82,260 KB
testcase_03 AC 151 ms
82,272 KB
testcase_04 AC 152 ms
82,476 KB
testcase_05 AC 162 ms
82,340 KB
testcase_06 AC 185 ms
82,332 KB
testcase_07 AC 187 ms
82,476 KB
testcase_08 AC 186 ms
82,344 KB
testcase_09 AC 187 ms
82,340 KB
testcase_10 AC 184 ms
82,272 KB
testcase_11 AC 184 ms
82,304 KB
testcase_12 AC 188 ms
82,296 KB
testcase_13 AC 191 ms
82,340 KB
testcase_14 AC 182 ms
82,280 KB
testcase_15 AC 184 ms
82,280 KB
testcase_16 AC 186 ms
82,260 KB
testcase_17 AC 193 ms
82,428 KB
testcase_18 AC 183 ms
82,272 KB
testcase_19 AC 186 ms
82,264 KB
testcase_20 AC 155 ms
82,388 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=1; i<=sqrt(MAX*100); i++) {
    for(j=i; j<=sqrt(MAX*100); j++) {
      ll a=i*i+j*j;
      if(a<MAX*100) cnt[a]+=4*(1+(i!=j));
    }
  }
  
  for(i=0; i<MAX*100; i++) if((ll)sqrt(i)==sqrt(i)) cnt[i]+=4;
  
  ll ans=0;
  for(i=X; i<=Y; i++) chmax(ans, cnt[i]);
  pt(ans);
  
}
 
 
0