結果
| 問題 | No.40 多項式の割り算 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2014-11-16 22:09:30 |
| 言語 | Ruby (4.0.2) |
| 結果 |
AC
|
| 実行時間 | 61 ms / 5,000 ms |
| コード長 | 338 bytes |
| 記録 | |
| コンパイル時間 | 103 ms |
| コンパイル使用メモリ | 9,216 KB |
| 実行使用メモリ | 15,232 KB |
| 最終ジャッジ日時 | 2026-06-05 09:54:55 |
| 合計ジャッジ時間 | 3,623 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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])