結果

問題 No.781 円周上の格子点の数え上げ
ユーザー eQeeQe
提出日時 2020-05-13 02:09:01
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 885 bytes
コンパイル時間 1,353 ms
コンパイル使用メモリ 158,836 KB
実行使用メモリ 82,432 KB
最終ジャッジ日時 2024-09-14 06:01:19
合計ジャッジ時間 5,710 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 162 ms
82,432 KB
testcase_01 WA -
testcase_02 AC 159 ms
82,432 KB
testcase_03 AC 159 ms
82,432 KB
testcase_04 AC 158 ms
82,304 KB
testcase_05 AC 159 ms
82,304 KB
testcase_06 AC 160 ms
82,432 KB
testcase_07 AC 160 ms
82,432 KB
testcase_08 AC 159 ms
82,432 KB
testcase_09 AC 160 ms
82,432 KB
testcase_10 AC 161 ms
82,304 KB
testcase_11 AC 160 ms
82,304 KB
testcase_12 AC 169 ms
82,432 KB
testcase_13 AC 172 ms
82,304 KB
testcase_14 AC 159 ms
82,304 KB
testcase_15 AC 159 ms
82,432 KB
testcase_16 AC 161 ms
82,304 KB
testcase_17 AC 167 ms
82,432 KB
testcase_18 AC 159 ms
82,432 KB
testcase_19 AC 160 ms
82,432 KB
testcase_20 AC 165 ms
82,304 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+1; j<=sqrt(MAX*100); j++) {
      ll a=i*i+j*j;
      if(a<MAX*100) cnt[a]+=8;
    }
  }
  
  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