http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2969
全场第一水题。我不知道怎么解释,看代码就好了。。。
#include<bits/stdc++.h> using namespace std; int main() { int t,n,a[101]; cin>>t; while(t--) { cin>>n; if(n==0) { cin>>a[0]; cout<<n<<endl; } else { for(int i=n; i>=0; i--) { cin>>a[i]; a[i]*=i; } cout<<a[n]; for(int i=n-1; i>0; i--) printf(" %d",a[i]); cout<<endl; } } return 0; }