1010 一元多项式求导 (25分)
生活随笔
收集整理的這篇文章主要介紹了
1010 一元多项式求导 (25分)
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
輸入樣例:
3 4 -5 2 6 1 -2 0
輸出樣例:
12 3 -10 1 6 0
# -*- coding: utf-8 -*-def get_derivation(lst):length = len(lst)idx = 0while idx < length:if lst[idx + 1] != 0:lst[idx] *= lst[idx + 1]lst[idx + 1] -= 1else:lst[idx] = 0idx += 2return lstif __name__ == '__main__':input_list = (input()).split()input_list = list(map(lambda x: eval(x), input_list))result = get_derivation(input_list)if result[0] == 0:print(0, 0)else:if not (result[-1] or result[-2]):del result[-2:]print(' '.join(map(str, result)))總結(jié)
以上是生活随笔為你收集整理的1010 一元多项式求导 (25分)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: jfinal java类型和数据库类型_
- 下一篇: Pygame下载和安装