結果

問題 No.40 多項式の割り算
ユーザー yuruhiyayuruhiya
提出日時 2020-05-15 15:52:43
言語 Crystal
(1.11.2)
結果
WA  
実行時間 -
コード長 224 bytes
コンパイル時間 18,931 ms
コンパイル使用メモリ 255,648 KB
実行使用メモリ 4,980 KB
最終ジャッジ日時 2023-09-13 10:35:16
合計ジャッジ時間 18,506 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,484 KB
testcase_01 AC 3 ms
4,384 KB
testcase_02 AC 3 ms
4,428 KB
testcase_03 AC 2 ms
4,408 KB
testcase_04 AC 4 ms
4,772 KB
testcase_05 WA -
testcase_06 AC 4 ms
4,944 KB
testcase_07 AC 4 ms
4,892 KB
testcase_08 AC 3 ms
4,476 KB
testcase_09 AC 3 ms
4,812 KB
testcase_10 AC 4 ms
4,840 KB
testcase_11 AC 3 ms
4,768 KB
testcase_12 WA -
testcase_13 AC 3 ms
4,940 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 4 ms
4,864 KB
testcase_17 AC 3 ms
4,480 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
4,568 KB
testcase_22 AC 3 ms
4,580 KB
testcase_23 AC 3 ms
4,592 KB
testcase_24 WA -
testcase_25 AC 3 ms
4,484 KB
testcase_26 AC 2 ms
4,464 KB
testcase_27 WA -
testcase_28 AC 2 ms
4,400 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 3 ms
4,412 KB
testcase_31 AC 3 ms
4,468 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = read_line.to_i
a = read_line.split.map(&.to_i).reverse
(n - 2).times do |i|
  k = a[i]
  a[i] -= k
  a[i + 2] += k
end
a.reverse!
if p = a.rindex {|i| i > 0 }
  a = a[0..p]
else
  a = [0]
end
puts a.size - 1, a.join(' ')
0