結果

問題 No.1162 Many Quotients hard
ユーザー ciel
提出日時 2021-06-05 18:24:35
言語 Ruby
(4.0.9 + ACL)
コンパイル:
ruby -w -c _filename_
実行:
ruby --yjit _filename_
結果
AC  
実行時間 61 ms / 2,000 ms
+ 658µs
コード長 191 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 67 ms
コンパイル使用メモリ 8,832 KB
実行使用メモリ 14,592 KB
最終ジャッジ日時 2026-10-29 19:28:32
合計ジャッジ時間 5,562 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 43
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #
raw source code

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
n=gets.to_i
s=n.isqrt
p 2*s-(n/s==s ? 1 : 0)
0