結果

問題 No.781 円周上の格子点の数え上げ
ユーザー MayimgMayimg
提出日時 2019-01-12 02:54:14
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 107 ms / 2,000 ms
コード長 442 bytes
コンパイル時間 1,383 ms
コンパイル使用メモリ 164,820 KB
実行使用メモリ 44,324 KB
最終ジャッジ日時 2023-08-21 05:17:18
合計ジャッジ時間 3,131 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 97 ms
44,304 KB
testcase_09 AC 101 ms
44,300 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 102 ms
44,304 KB
testcase_13 AC 107 ms
44,324 KB
testcase_14 AC 5 ms
7,512 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 57 ms
27,988 KB
testcase_18 AC 49 ms
27,924 KB
testcase_19 AC 52 ms
28,132 KB
testcase_20 AC 53 ms
27,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int p[123456789];
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);  
	int x, y;
	cin >> x >> y;
	int a = 1;
	while((a + 1) * (a + 1) <= y) {
		a++;
	}
	for(int i = 1; i <= a; i++) {
		for(int j = 0; j <= a; j++) {
			if(i * i + j * j > y) continue;
			p[i * i + j * j]++;
		}
	}
	int ans = 0;
	for(int i = x; i <= y; i++) {
		ans = max(ans, p[i]);
	}
	cout << ans * 4 << endl;
	return 0;
}
0