結果
| 問題 |
No.781 円周上の格子点の数え上げ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-13 02:12:45 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 125 ms / 2,000 ms |
| コード長 | 894 bytes |
| コンパイル時間 | 1,260 ms |
| コンパイル使用メモリ | 159,300 KB |
| 実行使用メモリ | 82,408 KB |
| 最終ジャッジ日時 | 2024-09-14 06:07:12 |
| 合計ジャッジ時間 | 4,830 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 |
ソースコード
#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);
}