結果
| 問題 | No.40 多項式の割り算 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2014-11-16 22:09:30 |
| 言語 | Ruby (4.0.7 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 60 ms / 5,000 ms |
| + 144µs | |
| コード長 | 338 bytes |
| 記録 | |
| コンパイル時間 | 9 ms |
| コンパイル使用メモリ | 8,704 KB |
| 実行使用メモリ | 14,976 KB |
| 最終ジャッジ日時 | 2026-10-10 01:09:30 |
| 合計ジャッジ時間 | 3,885 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
コンパイルメッセージ
Main.rb:1: 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])