結果

問題 No.781 円周上の格子点の数え上げ
ユーザー MayimgMayimg
提出日時 2019-01-11 22:33:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 549 bytes
コンパイル時間 1,849 ms
コンパイル使用メモリ 165,140 KB
実行使用メモリ 11,436 KB
最終ジャッジ日時 2023-08-20 11:36:39
合計ジャッジ時間 5,906 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,588 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 WA -
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 8 ms
4,376 KB
testcase_11 AC 26 ms
4,376 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);  
	int x, y;
	cin >> x >> y;
	long long ans = 0;
	for(int i = x; i <= y; i++) {
		if(i & 1 && i % 4 != 1) continue;
		if(i & 1 == 0 && i % 4 != 2) continue;
		long long tmp = 0;
		for(int j = 1; j * j <= i; j++) {
			if(i % j) continue;
			int k = i / j;
			if(j % 4 == 1) tmp++;
			if(j % 3 == 0) tmp--;
			if(k == j) continue;
			if(k % 4 == 1) tmp++;
			if(k % 3 == 0) tmp--;
		}
		ans = max(4 * tmp, ans);
	}
	cout << ans << endl;
	return 0;
}
0