結果

問題 No.781 円周上の格子点の数え上げ
ユーザー cielciel
提出日時 2019-01-13 15:28:02
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 270 bytes
コンパイル時間 690 ms
コンパイル使用メモリ 11,220 KB
実行使用メモリ 410,364 KB
最終ジャッジ日時 2023-08-26 20:58:39
合計ジャッジ時間 12,129 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
15,344 KB
testcase_01 AC 71 ms
15,336 KB
testcase_02 AC 68 ms
15,292 KB
testcase_03 AC 70 ms
15,292 KB
testcase_04 AC 72 ms
15,148 KB
testcase_05 AC 75 ms
15,336 KB
testcase_06 AC 80 ms
16,724 KB
testcase_07 AC 89 ms
18,828 KB
testcase_08 TLE -
testcase_09 TLE -
testcase_10 AC 77 ms
15,888 KB
testcase_11 AC 86 ms
17,028 KB
testcase_12 TLE -
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

class Integer
	def isqrt
		return 0 if self<=0
		return 1 if self<4 # 1
		x,y=0,self
		while x!=y&&x+1!=y
			x,y=y,(self/y+y)/2
		end
		x
	end
end
X,Y=gets.split.map &:to_i
R=Y.isqrt
H=[0]*(R*R*4)
(1..R).each{|x|(0..R).each{|y|H[x*x+y*y]+=1}}
p (X..Y).map{|i|H[i]}.max*4
0