結果
| 問題 |
No.40 多項式の割り算
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2014-11-16 22:09:30 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 99 ms / 5,000 ms |
| コード長 | 338 bytes |
| コンパイル時間 | 435 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 12,544 KB |
| 最終ジャッジ日時 | 2024-12-31 21:16:35 |
| 合計ジャッジ時間 | 4,786 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
コンパイルメッセージ
ruby: warning: shebang line ending with \r may cause problems Syntax OK
ソースコード
#!/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])