結果

問題 No.40 多項式の割り算
ユーザー yuruhiyayuruhiya
提出日時 2020-05-15 15:51:42
言語 Crystal
(1.11.2)
結果
WA  
実行時間 -
コード長 209 bytes
コンパイル時間 18,802 ms
コンパイル使用メモリ 255,232 KB
実行使用メモリ 5,040 KB
最終ジャッジ日時 2023-09-13 10:36:19
合計ジャッジ時間 20,286 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,416 KB
testcase_01 AC 2 ms
4,404 KB
testcase_02 WA -
testcase_03 AC 2 ms
4,404 KB
testcase_04 AC 3 ms
4,732 KB
testcase_05 WA -
testcase_06 AC 4 ms
4,872 KB
testcase_07 AC 4 ms
4,892 KB
testcase_08 AC 3 ms
4,468 KB
testcase_09 AC 3 ms
4,860 KB
testcase_10 AC 3 ms
4,860 KB
testcase_11 AC 3 ms
4,864 KB
testcase_12 WA -
testcase_13 AC 3 ms
4,960 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 3 ms
4,964 KB
testcase_17 AC 3 ms
4,532 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
4,540 KB
testcase_22 AC 3 ms
4,636 KB
testcase_23 AC 3 ms
4,740 KB
testcase_24 WA -
testcase_25 AC 2 ms
4,424 KB
testcase_26 AC 3 ms
4,420 KB
testcase_27 WA -
testcase_28 AC 2 ms
4,488 KB
testcase_29 AC 3 ms
4,520 KB
testcase_30 AC 3 ms
4,488 KB
testcase_31 AC 2 ms
4,416 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 2 ms
4,376 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]
end
puts a.size - 1, a.join(' ')
0