結果

問題 No.781 円周上の格子点の数え上げ
ユーザー iicafiaxus
提出日時 2019-01-11 22:28:55
言語 D
(dmd 2.109.1)
結果
TLE  
実行時間 -
コード長 694 bytes
コンパイル時間 1,083 ms
コンパイル使用メモリ 125,580 KB
実行使用メモリ 215,012 KB
最終ジャッジ日時 2024-06-13 02:39:16
合計ジャッジ時間 11,794 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10 TLE * 4 -- * 7
権限があれば一括ダウンロードができます

ソースコード

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