結果

問題 No.40 多項式の割り算
ユーザー cielciel
提出日時 2014-11-16 22:09:30
言語 Ruby
(3.3.0)
結果
AC  
実行時間 91 ms / 5,000 ms
コード長 338 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 11,304 KB
実行使用メモリ 15,568 KB
最終ジャッジ日時 2023-08-30 07:24:31
合計ジャッジ時間 4,633 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,124 KB
testcase_01 AC 81 ms
15,280 KB
testcase_02 AC 80 ms
15,032 KB
testcase_03 AC 80 ms
15,148 KB
testcase_04 AC 86 ms
15,412 KB
testcase_05 AC 88 ms
15,428 KB
testcase_06 AC 89 ms
15,424 KB
testcase_07 AC 90 ms
15,496 KB
testcase_08 AC 82 ms
15,300 KB
testcase_09 AC 87 ms
15,404 KB
testcase_10 AC 89 ms
15,372 KB
testcase_11 AC 86 ms
15,364 KB
testcase_12 AC 84 ms
15,044 KB
testcase_13 AC 89 ms
15,376 KB
testcase_14 AC 85 ms
15,568 KB
testcase_15 AC 86 ms
15,532 KB
testcase_16 AC 90 ms
15,408 KB
testcase_17 AC 84 ms
15,236 KB
testcase_18 AC 91 ms
15,368 KB
testcase_19 AC 90 ms
15,376 KB
testcase_20 AC 88 ms
15,180 KB
testcase_21 AC 85 ms
15,264 KB
testcase_22 AC 84 ms
15,240 KB
testcase_23 AC 86 ms
15,200 KB
testcase_24 AC 90 ms
15,536 KB
testcase_25 AC 81 ms
15,124 KB
testcase_26 AC 81 ms
15,036 KB
testcase_27 AC 81 ms
15,252 KB
testcase_28 AC 82 ms
15,168 KB
testcase_29 AC 82 ms
15,020 KB
testcase_30 AC 82 ms
15,128 KB
testcase_31 AC 82 ms
15,284 KB
testcase_32 AC 81 ms
15,152 KB
testcase_33 AC 81 ms
15,292 KB
testcase_34 AC 81 ms
15,148 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/usr/bin/ruby: warning: shebang line ending with \r may cause problems
Syntax OK

ソースコード

diff #

#!/usr/bin/ruby

def checkio(exp,div)
	c=[]
	while div.size<=exp.size
		d=exp[-1]/div[-1]
		c.push(d)
		div.size.times{|i|exp[i+exp.size-div.size]-=div[i]*d}
		#raise if exp[-1]!=0
		exp.pop
	end
	exp.pop() while exp.size>1 && exp[-1]==0
	puts exp.size-1
	puts exp*' '
end

gets
checkio(gets.split.map(&:to_i),[0,-1,0,1])
0