結果

問題 No.781 円周上の格子点の数え上げ
ユーザー
提出日時 2021-02-11 17:34:57
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 653 bytes
コンパイル時間 702 ms
コンパイル使用メモリ 93,752 KB
実行使用メモリ 42,496 KB
最終ジャッジ日時 2024-07-18 06:03:02
合計ジャッジ時間 2,224 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int co[10000010] = {};
bool bo[10000010] = { false };
int main() {
	int x, y;
	cin >> x >> y;
	for (int i = 1; i * i <= y; i++) {
		co[i * i]++;
		for (int j = 1; j * j <= y; j++) {
			if (i * i + j * j <= y) {
				co[i * i + j * j]++;
			}
		}
	}
	int ans = 0;
	for (int i = x; i <= y; i++) {
		if (ans < co[i]) {
			ans = co[i];
		}
	}
	cout << ans * 4 << endl;
}
0