結果

問題 No.40 多項式の割り算
ユーザー siman
提出日時 2015-01-11 04:27:41
言語 Ruby
(3.4.1)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 349 bytes
コンパイル時間 61 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 12,672 KB
最終ジャッジ日時 2024-06-13 03:43:08
合計ジャッジ時間 4,003 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

class A
  def initialize
    d = gets.chomp.to_i
    a = gets.chomp.split(' ').map(&:to_i).reverse

    0.upto(d-3) do |num|
      a[num+2] += a[num]
      a[num] = 0
    end

    if a.index{|i| i != 0}
      puts d - a.index{|i| i != 0}
    else
      puts 0
    end
    a.delete(0)
    puts (a.size.zero?)? 0 : a.reverse.join(' ')
  end
end

A.new
0