結果

問題 No.1047 Zero (Novice)
ユーザー horiesiniti
提出日時 2023-02-04 19:15:30
言語 Ruby
(3.4.1)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 133 bytes
コンパイル時間 453 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-07-03 15:53:10
合計ジャッジ時間 3,150 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:11: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

a,b=gets.split(" ").map{|e|e.to_i}
n=b
ans=1
if a==-1 || b==0 then
	while n!=0 do
		n=a*n+b
		ans+=1
	end
	puts ans
else
	puts -1
end
0