結果

問題 No.781 円周上の格子点の数え上げ
ユーザー iicafiaxusiicafiaxus
提出日時 2019-01-11 22:28:55
言語 D
(dmd 2.107.1)
結果
TLE  
実行時間 -
コード長 694 bytes
コンパイル時間 683 ms
コンパイル使用メモリ 111,404 KB
実行使用メモリ 209,680 KB
最終ジャッジ日時 2023-09-03 22:00:16
合計ジャッジ時間 14,801 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,384 KB
testcase_06 AC 5 ms
4,380 KB
testcase_07 AC 10 ms
6,448 KB
testcase_08 AC 1,784 ms
208,228 KB
testcase_09 AC 1,854 ms
208,352 KB
testcase_10 AC 4 ms
4,380 KB
testcase_11 AC 6 ms
4,380 KB
testcase_12 TLE -
testcase_13 TLE -
testcase_14 AC 55 ms
17,744 KB
testcase_15 AC 3 ms
4,376 KB
testcase_16 AC 3 ms
4,376 KB
testcase_17 AC 1,489 ms
64,128 KB
testcase_18 AC 973 ms
64,196 KB
testcase_19 AC 977 ms
65,024 KB
testcase_20 AC 937 ms
65,060 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[int] count;
	for(int a = 0; a * a <= y; a ++){
		for(int b = 1; b * b <= y; b ++){
			int r = a * a + b * b;
			if(r > y) break;
			if(r in count) count[r] += 1;
			else count[r] = 1;
		}
	}
	
	int countmax = 0;
	for(int r = x; r <= y; r ++){
		if(r in count && count[r] > countmax) countmax = count[r];
	}
	
	(countmax * 4).writeln;
	
}
0