結果

問題 No.40 多項式の割り算
ユーザー あかりきあかりき
提出日時 2021-02-08 10:23:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 5,000 ms
コード長 441 bytes
コンパイル時間 398 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 76,784 KB
最終ジャッジ日時 2023-09-18 16:10:54
合計ジャッジ時間 4,629 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,456 KB
testcase_01 AC 73 ms
71,412 KB
testcase_02 AC 74 ms
71,456 KB
testcase_03 AC 75 ms
71,436 KB
testcase_04 AC 80 ms
76,500 KB
testcase_05 AC 79 ms
76,540 KB
testcase_06 AC 80 ms
76,616 KB
testcase_07 AC 81 ms
76,548 KB
testcase_08 AC 80 ms
76,288 KB
testcase_09 AC 81 ms
76,700 KB
testcase_10 AC 82 ms
76,784 KB
testcase_11 AC 80 ms
76,544 KB
testcase_12 AC 80 ms
76,352 KB
testcase_13 AC 81 ms
76,636 KB
testcase_14 AC 79 ms
76,616 KB
testcase_15 AC 79 ms
76,612 KB
testcase_16 AC 80 ms
76,616 KB
testcase_17 AC 79 ms
76,520 KB
testcase_18 AC 81 ms
76,328 KB
testcase_19 AC 83 ms
76,472 KB
testcase_20 AC 81 ms
76,464 KB
testcase_21 AC 81 ms
76,500 KB
testcase_22 AC 82 ms
76,476 KB
testcase_23 AC 82 ms
76,432 KB
testcase_24 AC 81 ms
76,436 KB
testcase_25 AC 75 ms
71,388 KB
testcase_26 AC 73 ms
71,488 KB
testcase_27 AC 74 ms
71,320 KB
testcase_28 AC 74 ms
71,496 KB
testcase_29 AC 74 ms
71,264 KB
testcase_30 AC 72 ms
71,284 KB
testcase_31 AC 74 ms
71,272 KB
testcase_32 AC 72 ms
71,480 KB
testcase_33 AC 74 ms
71,428 KB
testcase_34 AC 74 ms
71,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

d=int(input())
a=list(map(int,input().split()))
if d<=2:
  print(d)
  for i in range(d+1):
    a[i]=str(a[i])
  print(' '.join(a))
  exit()
a.reverse()
b=[1,0,-1,0]
for i in range(d-2):
  x=a[i]
  for j in range(4):
    a[i+j]-=x*b[j]
a.reverse()

if a[2]==0 and a[1]==0 and a[0]==0:
  print(0)
  print(0)
elif a[2]==0 and a[1]==0:
  print(0)
  print(a[0])
elif a[2]==0:
  print(1)
  print(a[0],a[1])
else:
  print(2)
  print(a[0],a[1],a[2])
0