結果

問題 No.781 円周上の格子点の数え上げ
ユーザー Mayimg
提出日時 2019-01-11 22:33:48
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 549 bytes
コンパイル時間 1,622 ms
コンパイル使用メモリ 165,872 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2024-11-30 13:20:59
合計ジャッジ時間 11,341 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 WA * 1 TLE * 3
権限があれば一括ダウンロードができます

ソースコード

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