結果

問題 No.40 多項式の割り算
ユーザー DialBirdDialBird
提出日時 2017-02-13 10:15:07
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 441 bytes
コンパイル時間 70 ms
コンパイル使用メモリ 11,472 KB
実行使用メモリ 15,568 KB
最終ジャッジ日時 2023-08-28 15:08:49
合計ジャッジ時間 4,122 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,048 KB
testcase_01 AC 81 ms
15,192 KB
testcase_02 WA -
testcase_03 AC 77 ms
15,100 KB
testcase_04 AC 80 ms
15,212 KB
testcase_05 AC 80 ms
15,392 KB
testcase_06 AC 83 ms
15,312 KB
testcase_07 AC 83 ms
15,516 KB
testcase_08 AC 79 ms
15,080 KB
testcase_09 AC 82 ms
15,568 KB
testcase_10 AC 80 ms
15,252 KB
testcase_11 AC 79 ms
15,300 KB
testcase_12 AC 79 ms
15,052 KB
testcase_13 AC 83 ms
15,392 KB
testcase_14 AC 79 ms
15,128 KB
testcase_15 AC 80 ms
15,324 KB
testcase_16 AC 80 ms
15,348 KB
testcase_17 AC 78 ms
15,316 KB
testcase_18 AC 80 ms
15,336 KB
testcase_19 AC 82 ms
15,464 KB
testcase_20 AC 79 ms
15,272 KB
testcase_21 AC 79 ms
15,220 KB
testcase_22 AC 79 ms
15,124 KB
testcase_23 AC 79 ms
15,104 KB
testcase_24 AC 80 ms
15,332 KB
testcase_25 AC 77 ms
15,200 KB
testcase_26 AC 77 ms
15,132 KB
testcase_27 AC 78 ms
15,228 KB
testcase_28 AC 76 ms
15,104 KB
testcase_29 AC 77 ms
15,156 KB
testcase_30 AC 77 ms
15,132 KB
testcase_31 AC 77 ms
15,076 KB
testcase_32 AC 77 ms
15,224 KB
testcase_33 AC 78 ms
15,200 KB
testcase_34 AC 76 ms
15,160 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

class Solve
  def initialize
    _ = gets.to_i
    @a_list = gets.chomp.split.map(&:to_i)
  end

  def run
    len = @a_list.size
    (len - 1).downto(3) do |i|
      if @a_list[i] != 0
        @a_list[i-2] += @a_list[i]
        @a_list[i] = 0
      end
    end

    3.downto(0) do |i|
      if @a_list[i] != 0 && @a_list[i] != nil
        puts i
        puts @a_list[0..i].join(' ')
        break
      end
    end
  end
end

 Solve.new.run
0