結果

問題 No.781 円周上の格子点の数え上げ
ユーザー leaf_1415leaf_1415
提出日時 2019-01-11 21:41:26
言語 C++11
(gcc 8.5.0)
結果
AC  
実行時間 396 ms / 2,000 ms
コード長 470 bytes
コンパイル時間 349 ms
使用メモリ 81,708 KB
最終ジャッジ日時 2023-01-06 10:15:54
合計ジャッジ時間 10,003 ms
ジャッジサーバーID
(参考情報)
judge16 / judge10
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 391 ms
81,556 KB
testcase_01 AC 389 ms
81,560 KB
testcase_02 AC 393 ms
81,684 KB
testcase_03 AC 379 ms
81,624 KB
testcase_04 AC 379 ms
81,560 KB
testcase_05 AC 387 ms
81,624 KB
testcase_06 AC 385 ms
81,660 KB
testcase_07 AC 388 ms
81,552 KB
testcase_08 AC 389 ms
81,708 KB
testcase_09 AC 385 ms
81,560 KB
testcase_10 AC 386 ms
81,628 KB
testcase_11 AC 389 ms
81,704 KB
testcase_12 AC 393 ms
81,608 KB
testcase_13 AC 395 ms
81,680 KB
testcase_14 AC 387 ms
81,668 KB
testcase_15 AC 382 ms
81,684 KB
testcase_16 AC 382 ms
81,628 KB
testcase_17 AC 396 ms
81,628 KB
testcase_18 AC 393 ms
81,560 KB
testcase_19 AC 389 ms
81,560 KB
testcase_20 AC 390 ms
81,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#define llint long long

using namespace std;

llint x, y;
vector<llint> vec;

llint cnt[10000005];

int main(void)
{
	cin >> x >> y;
	
	for(int i = 0; i*i <= 10000000; i++) vec.push_back(i*i);
	
	llint N = 3500;
	for(int i = -N; i <= N; i++){
		for(int j = -N; j <= N; j++){
			if(i*i+j*j < 10000005) cnt[i*i+j*j]++;
		}
	}
	
	llint ans = 0;
	for(int i = x; i <= y; i++) ans = max(ans, cnt[i]);
	cout << ans << endl;
	
	return 0;
}
0