結果

問題 No.781 円周上の格子点の数え上げ
ユーザー cielciel
提出日時 2019-01-13 15:23:03
言語 Crystal
(1.11.2)
結果
TLE  
実行時間 -
コード長 293 bytes
コンパイル時間 16,777 ms
コンパイル使用メモリ 259,672 KB
実行使用メモリ 237,768 KB
最終ジャッジ日時 2023-09-13 09:57:25
合計ジャッジ時間 27,193 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,436 KB
testcase_01 AC 3 ms
4,384 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 6 ms
5,664 KB
testcase_07 AC 10 ms
7,028 KB
testcase_08 TLE -
testcase_09 AC 1,904 ms
224,640 KB
testcase_10 AC 4 ms
4,888 KB
testcase_11 AC 7 ms
5,700 KB
testcase_12 TLE -
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def isqrt(n)
	return 0_i64 if n<=0_i64
	return 1_i64 if n<4_i64 # 1
	x,y=0_i64,n
	while x!=y&&x+1_i64!=y
		x,y=y,(n/y+y)/2_i64
	end
	x
end
h=Hash(Int64,Int32).new 0
x,y=gets.not_nil!.split.map &.to_i64
r=isqrt y
(1_i64..r).each{|x|(0_i64..r).each{|y|h[x*x+y*y]+=1}}
p (x..y).map{|i|h[i]}.max*4
0