結果

問題 No.781 円周上の格子点の数え上げ
ユーザー okok
提出日時 2019-01-11 22:28:41
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 259 ms / 2,000 ms
コード長 866 bytes
コンパイル時間 1,796 ms
コンパイル使用メモリ 73,324 KB
実行使用メモリ 90,936 KB
最終ジャッジ日時 2023-08-20 11:35:28
合計ジャッジ時間 7,469 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 198 ms
90,796 KB
testcase_01 AC 175 ms
90,808 KB
testcase_02 AC 177 ms
90,752 KB
testcase_03 AC 169 ms
90,704 KB
testcase_04 AC 176 ms
90,628 KB
testcase_05 AC 176 ms
90,808 KB
testcase_06 AC 176 ms
90,824 KB
testcase_07 AC 174 ms
90,676 KB
testcase_08 AC 174 ms
90,672 KB
testcase_09 AC 168 ms
90,628 KB
testcase_10 AC 175 ms
90,684 KB
testcase_11 AC 244 ms
90,680 KB
testcase_12 AC 259 ms
90,792 KB
testcase_13 AC 256 ms
90,828 KB
testcase_14 AC 238 ms
90,792 KB
testcase_15 AC 240 ms
90,828 KB
testcase_16 AC 240 ms
90,748 KB
testcase_17 AC 249 ms
90,760 KB
testcase_18 AC 207 ms
90,708 KB
testcase_19 AC 171 ms
90,936 KB
testcase_20 AC 172 ms
90,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF (long long)(1e18)
#define MOD (int)(1e9+7)

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

#define MAX 10000002

int temp[MAX];
bool tete[MAX];

void fuga(){
	temp[0] = 1;
	vector<int> vec;
	
	for(int i = 0; i*i <= MAX; i++){
		vec.push_back(i*i);
		tete[i*i] = true;
		temp[i*i]--;
	}
	
	for(int i = 0; i < vec.size(); i++){
		for(int j = 0; j < vec.size(); j++){
			if(vec[i]+vec[j] < MAX) temp[vec[i]+vec[j]]++;
			else break;
		}
	}
	
}

signed main(){
	cout<<fixed<<setprecision(7);
	
	int X, Y;
	int ans = 0;
	
	cin>>X>>Y;
	fuga();
	
	for(int i = X; i <= Y; i++){
		ans = max(ans,temp[i]*4);
	}
	
	
	cout<<ans<<endl;
	
	
	return 0;
}
0