結果

問題 No.40 多項式の割り算
ユーザー cielciel
提出日時 2014-11-16 22:03:41
言語 Ruby
(3.3.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 420 bytes
コンパイル時間 67 ms
コンパイル使用メモリ 11,284 KB
実行使用メモリ 89,040 KB
最終ジャッジ日時 2023-08-30 07:28:17
合計ジャッジ時間 53,601 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
15,308 KB
testcase_01 AC 85 ms
15,280 KB
testcase_02 AC 81 ms
15,168 KB
testcase_03 AC 81 ms
15,140 KB
testcase_04 AC 1,779 ms
88,528 KB
testcase_05 AC 2,838 ms
87,696 KB
testcase_06 AC 4,753 ms
82,744 KB
testcase_07 TLE -
testcase_08 AC 95 ms
17,140 KB
testcase_09 AC 2,406 ms
86,260 KB
testcase_10 AC 4,277 ms
82,748 KB
testcase_11 AC 1,500 ms
88,668 KB
testcase_12 AC 640 ms
76,104 KB
testcase_13 AC 4,224 ms
83,152 KB
testcase_14 AC 1,845 ms
88,368 KB
testcase_15 AC 1,701 ms
89,040 KB
testcase_16 AC 4,224 ms
86,156 KB
testcase_17 AC 405 ms
58,632 KB
testcase_18 AC 3,755 ms
84,184 KB
testcase_19 TLE -
testcase_20 AC 1,180 ms
86,636 KB
testcase_21 AC 298 ms
45,808 KB
testcase_22 AC 231 ms
35,344 KB
testcase_23 AC 1,111 ms
87,472 KB
testcase_24 AC 2,775 ms
87,356 KB
testcase_25 AC 78 ms
15,324 KB
testcase_26 AC 78 ms
15,280 KB
testcase_27 AC 79 ms
15,156 KB
testcase_28 AC 80 ms
15,252 KB
testcase_29 AC 77 ms
15,124 KB
testcase_30 AC 78 ms
15,324 KB
testcase_31 AC 79 ms
15,304 KB
testcase_32 AC 79 ms
15,288 KB
testcase_33 AC 78 ms
15,136 KB
testcase_34 AC 81 ms
15,268 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/usr/bin/ruby: warning: shebang line ending with \r may cause problems
Syntax OK

ソースコード

diff #

#!/usr/bin/ruby

def sub(a,b)
	m=[a.size,b.size].max
	m.times.map{|i|(a[i]||0) - (b[i]||0)}
end

def checkio(exp,div)
	c=[]
	while div.size<=exp.size
		d=exp[-1]/div[-1]
		c.push(d)
		exp=sub(exp,[0]*(exp.size-div.size)+div.map{|e|e*d})
		#assert 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