哈理工2015暑假训练赛BNU16488 Easy Task(简单题)
来源:互联网 发布:mac系统怎么制作铃声 编辑:程序博客网 时间:2024/06/05 18:46
Description
Calculating the derivation of a polynomial is an easy task. Given a function f(x) , we use (f(x))' to denote its derivation. We use x^n to denote xn. To calculate the derivation of a polynomial, you should know 3 rules:
(1) (C)'=0 where C is a constant.
(2) (Cx^n)'=C*n*x^(n-1) where n>=1 and C is a constant.
(3) (f1(x)+f2(x))'=(f1(x))'+(f2(x))'.
It is easy to prove that the derivation a polynomial is also a polynomial.
Here comes the problem, given a polynomial f(x) with non-negative coefficients, can you write a program to calculate the derivation of it?
Input
Standard input will contain multiple test cases. The first line of the input is a single integerT (1 <= T <= 1000) which is the number of test cases. And it will be followed byT consecutive test cases.
There are exactly 2 lines in each test case. The first line of each test case is a single line containing an integerN (0 <= N <= 100). The second line contains N + 1 non-negative integers,CN, CN-1, ..., C1, C0, ( 0 <= Ci <= 1000), which are the coefficients of f(x).Ci is the coefficient of the term with degree i in f(x). (CN!=0)
Output
For each test case calculate the result polynomial g(x) also in a single line.
(1) If g(x) = 0 just output integer 0.otherwise
(2) suppose g(x)= Cmx^m+Cm-1x^(m-1)+...+C0 (Cm!=0),then output the integersCm,Cm-1,...C0.
(3) There is a single space between two integers but no spaces after the last integer.
Sample Input
301023 2 1310 0 1 2
Sample Output
06 230 0 1现场秒杀题。不解释。#include<iostream>#include<sstream>#include<algorithm>#include<cstdio>#include<string.h>#include<cctype>#include<string>#include<cmath>#include<vector>#include<stack>#include<queue>#include<map>#include<set>using namespace std;int main(){ int cnt[10000]; int t;cin>>t; while(t--) { int n;cin>>n; for(int i=0;i<=n;i++) { scanf("%d",&cnt[i]); } if(n==0) { cout<<0<<endl;continue; } int x=n; cout<<cnt[0]*x;x--; for(int i=1;i<n;i++) { cout<<" "<<cnt[i]*x; x--; } cout<<endl; } return 0;}
- 哈理工2015暑假训练赛BNU16488 Easy Task(简单题)
- BNU16488:Easy Task
- ZOJ 2969 && BNU16488 Easy Task
- 哈理工2015 暑假训练赛 zoj 2976 Light Bulbs
- 哈理工2015暑假训练赛 zoj 2078Phone Cell
- hdoj1076 An Easy Task(简单题)
- 哈理工训练赛 青蛙过河 dp
- 哈理工2015暑假集训 zoj 2975 Kinds of Fuwas
- 2015暑假训练题解(二分)
- 暑假训练赛20160719
- 暑假训练赛20160720
- 2015暑假训练总结
- 山东理工训练赛4
- 训练赛 An Easy Game(dp)
- [简单数学]ZOJ 2969 Easy Task
- 哈理工 OJ 2215 Angle(简单的思维题)
- 哈理工院赛训练题目 Kid-排列
- An Easy Task(简箪题)
- poj 2184 - Cow Exhibition (01背包) 解题报告
- 单链表的析构函数
- 欢迎使用CSDN-markdown编辑器
- Android中用application在两个activity中进行数据共享(1)
- 如何在Windows平台下安装或卸载Apache服务
- 哈理工2015暑假训练赛BNU16488 Easy Task(简单题)
- wiresharek 分析TCP 报文头
- 编程实现单链表的排序
- [IOS] Class Memory Analysis
- python面向对象
- NLog 相关
- 《汇编语言》第二版 王爽著 第八章 数据处理的两个基本问题 要点
- 51 单片机内存的认识
- *HDU 2196 - Computer(树形DP)