ZOJ 2969 Easy Task
E - Easy Task
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 integer T (1 <= T <= 1000) which is the number of test cases. And it will be followed by T 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 integer N (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 integers Cm,Cm-1,...C0.
(3) There is a single space between two integers but no spaces after the last integer.
Sample Input
3
0
10
2
3 2 1
3
10 0 1 2
Sample Output
0
6 2
30 0 1
题意就是求导……
没啥好说的
#include<iostream>
#include<string.h>
#include<stdio.h>
#include<ctype.h>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include<vector>
#include<map>
#include<deque>
#include<list>
using namespace std;
int main()
{
int a;
cin>>a;
for(int i=;i<=a;i++)
{
int b;
cin>>b;
int p=b+;
while(p--)
{
int c;
cin>>c;
if(b==)
{
printf("0\n");
break;
}
if(p==)
{
printf("\n");
break;
}
if(p==)
printf("%d",c*p);
else
printf("%d ",c*p);
} }
return ;
}
ZOJ 2969 Easy Task的更多相关文章
- CodeForces462 A. Appleman and Easy Task
A. Appleman and Easy Task time limit per test 1 second memory limit per test 256 megabytes input sta ...
- An Easy Task
An Easy Task Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total ...
- HDU-------An Easy Task
An Easy Task Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total ...
- An Easy Task(简箪题)
B. An Easy Task Time Limit: 1000ms Case Time Limit: 1000ms Memory Limit: 65536KB 64-bit integer IO f ...
- HDU-1076-An Easy Task(Debian下水题測试.....)
An Easy Task Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tot ...
- Codeforces 263A. Appleman and Easy Task
A. Appleman and Easy Task time limit per test 1 second memory limit per test 256 megabytes input ...
- Codeforces Round #263 (Div. 2) A. Appleman and Easy Task【地图型搜索/判断一个点四周‘o’的个数的奇偶】
A. Appleman and Easy Task time limit per test 1 second memory limit per test 256 megabytes input sta ...
- 【ZOJ 3844】Easy Task
题意 每次把序列中最大的数a的一个和最小的数b的一个变成a-b.求最后是否能使序列里的数全部相同,能则输出这个相同的数. 分析 一定是有解的,不断减少最大数的个数,最大数减少为0个时,就是减少了不同数 ...
- HD1046An Easy Task
Problem Description Ignatius was born in a leap year, so he want to know when he could hold his birt ...
随机推荐
- MySQL增量备份与恢复实例【转】
小量的数据库可以每天进行完整备份,因为这也用不了多少时间,但当数据库很大时,就不太可能每天进行一次完整备份了,这时候就可以使用增量备份.增量备份的原理就是使用了mysql的binlog日志.本次操作的 ...
- ETL利器Kettle实战应用解析系列三
本系列文章主要索引如下: 一.ETL利器Kettle实战应用解析系列一[Kettle使用介绍] 二.ETL利器Kettle实战应用解析系列二 [应用场景和实战DEMO下载] 三.ETL利器Kettle ...
- Flask小demo---代码统计系统
功能要求: 管理员登录 # 第一天 班级管理 # 第一天 学生管理 # 第一天 学生登录 上传代码(zip文件和.py文件) 查看个人提交记录列表 highchar统计 学生列表上方使用柱状图展示现班 ...
- spring单元测试的基本配置
@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:trade.ap ...
- Ubuntu下软件安装方式、PATH配置、查找安装位置
Ubuntu 18.04, 安装方式 目前孤知道的Ubuntu下安装软件方式有3种(命令): 1.make 2.apt/apt-get 3.dpkg 方式1基于软件源码安装,需要经历配置(可选).编译 ...
- ZOJ 3469 Food Delivery(区间DP好题)
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4255 题目大意:在x轴上有n个客人,每个客人每分钟增加的愤怒值不同. ...
- CVE-2013-2729 Adobe Reader和Acrobat 数字错误漏洞
这个洞是在论坛里看到的,感觉很有意思,来学习一下.个人感觉IE或者说是浏览器的洞和Adobe洞都是比较难调的,主要是有大量的类难以摸清之间的关系. 这个洞是一个整数溢出的洞,这个不是重点.重点是利用的 ...
- 在Visio里加上、下标方法
添加上标:选中要成为上标的文字,ctrl+shift+“=” 添加下标:选中要成为下标的文字,ctrl+“=”
- 浏览器开启web通知。
https://www.cnblogs.com/xcsn/p/7767092.html
- Python全栈开发之16、jquery
一.查找元素 1.选择器 1.1 基本选择器 $("*") $("#id") $(".class") $("ele ...