結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 82 ms
15,156 KB
testcase_02 WA -
testcase_03 AC 82 ms
15,308 KB
testcase_04 AC 82 ms
15,368 KB
testcase_05 AC 88 ms
15,440 KB
testcase_06 AC 84 ms
15,308 KB
testcase_07 AC 87 ms
15,576 KB
testcase_08 AC 82 ms
15,324 KB
testcase_09 AC 86 ms
15,404 KB
testcase_10 AC 86 ms
15,344 KB
testcase_11 AC 86 ms
15,288 KB
testcase_12 AC 79 ms
15,108 KB
testcase_13 AC 84 ms
15,456 KB
testcase_14 AC 85 ms
15,148 KB
testcase_15 AC 86 ms
15,360 KB
testcase_16 AC 88 ms
15,552 KB
testcase_17 AC 84 ms
15,224 KB
testcase_18 AC 85 ms
15,408 KB
testcase_19 AC 87 ms
15,592 KB
testcase_20 AC 84 ms
15,068 KB
testcase_21 AC 84 ms
15,136 KB
testcase_22 AC 83 ms
15,144 KB
testcase_23 AC 86 ms
15,132 KB
testcase_24 AC 87 ms
15,508 KB
testcase_25 AC 82 ms
15,324 KB
testcase_26 AC 78 ms
15,296 KB
testcase_27 AC 77 ms
15,328 KB
testcase_28 WA -
testcase_29 AC 78 ms
15,132 KB
testcase_30 AC 76 ms
15,096 KB
testcase_31 AC 77 ms
15,092 KB
testcase_32 WA -
testcase_33 AC 79 ms
15,132 KB
testcase_34 AC 76 ms
15,148 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
        puts i
        puts @a_list[0..i].join(' ')
        break
      end
    end
  end
end

 Solve.new.run
0