結果

問題 No.781 円周上の格子点の数え上げ
ユーザー okok
提出日時 2019-01-11 22:28:41
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 866 bytes
コンパイル時間 1,726 ms
コンパイル使用メモリ 74,404 KB
実行使用メモリ 90,844 KB
最終ジャッジ日時 2024-05-07 18:23:17
合計ジャッジ時間 4,741 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
90,184 KB
testcase_01 AC 123 ms
90,700 KB
testcase_02 AC 124 ms
90,184 KB
testcase_03 AC 125 ms
90,568 KB
testcase_04 AC 126 ms
90,696 KB
testcase_05 AC 130 ms
90,844 KB
testcase_06 AC 126 ms
90,240 KB
testcase_07 AC 123 ms
90,836 KB
testcase_08 AC 125 ms
90,568 KB
testcase_09 AC 126 ms
90,060 KB
testcase_10 AC 125 ms
90,564 KB
testcase_11 AC 125 ms
90,828 KB
testcase_12 AC 130 ms
90,696 KB
testcase_13 AC 132 ms
90,312 KB
testcase_14 AC 122 ms
90,828 KB
testcase_15 AC 124 ms
90,308 KB
testcase_16 AC 128 ms
90,824 KB
testcase_17 AC 130 ms
90,700 KB
testcase_18 AC 130 ms
90,316 KB
testcase_19 AC 126 ms
90,056 KB
testcase_20 AC 125 ms
90,568 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