結果

問題 No.781 円周上の格子点の数え上げ
ユーザー iicafiaxusiicafiaxus
提出日時 2019-01-11 22:33:40
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 985 ms / 2,000 ms
コード長 774 bytes
コンパイル時間 857 ms
コンパイル使用メモリ 111,504 KB
実行使用メモリ 115,080 KB
最終ジャッジ日時 2023-09-03 22:00:37
合計ジャッジ時間 8,333 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 6 ms
4,376 KB
testcase_07 AC 11 ms
5,140 KB
testcase_08 AC 965 ms
113,684 KB
testcase_09 AC 960 ms
113,700 KB
testcase_10 AC 3 ms
4,380 KB
testcase_11 AC 6 ms
4,380 KB
testcase_12 AC 985 ms
115,080 KB
testcase_13 AC 978 ms
114,752 KB
testcase_14 AC 51 ms
9,784 KB
testcase_15 AC 4 ms
4,380 KB
testcase_16 AC 4 ms
4,376 KB
testcase_17 AC 571 ms
63,372 KB
testcase_18 AC 560 ms
66,156 KB
testcase_19 AC 574 ms
65,992 KB
testcase_20 AC 578 ms
66,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.conv, std.string, std.bigint;
import std.math, std.random, std.datetime;
import std.array, std.range, std.algorithm, std.container, std.format;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

void main(){
	int x = read.to!int;
	int y = read.to!int;
	
	int[] qs;
	for(int a = 0; a <= y; a ++){
		qs ~= a * a;
	}
	
	int[] count;
	for(int r = 0; r <= y; r ++){
		count ~= 0;
	}
	
	
	int bmax = y;
	for(int a = 0; qs[a] <= y; a ++){
		int r;
		for(int b = 1; qs[b] <= y; b ++){
			r = qs[a] + qs[b];
			if(r > y) break;
			count[r] += 1;
		}
	}
	
	int countmax = 0;
	for(int r = x; r <= y; r ++){
		if(count[r] > countmax) countmax = count[r];
	}
	
	(countmax * 4).writeln;
	
}
0