結果

問題 No.781 円周上の格子点の数え上げ
ユーザー furafura
提出日時 2020-05-05 16:29:38
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 337 bytes
コンパイル時間 1,910 ms
コンパイル使用メモリ 197,492 KB
実行使用メモリ 42,656 KB
最終ジャッジ日時 2023-09-09 03:44:10
合計ジャッジ時間 3,476 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 101 ms
42,532 KB
testcase_09 AC 93 ms
42,532 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 100 ms
42,520 KB
testcase_13 AC 98 ms
42,656 KB
testcase_14 AC 5 ms
7,692 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 54 ms
28,028 KB
testcase_18 AC 46 ms
28,052 KB
testcase_19 AC 57 ms
28,036 KB
testcase_20 AC 53 ms
28,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int x,y; scanf("%d%d",&x,&y);

	static int cnt[10000001];
	for(int i=0;i*i<=y;i++){
		for(int j=1;i*i+j*j<=y;j++){
			cnt[i*i+j*j]++;
		}
	}

	int ans=0;
	for(int i=x;i<=y;i++) ans=max(ans,cnt[i]);
	printf("%d\n",4*ans);

	return 0;
}
0