天津大学2019ACM新生赛

Problem A:Auto-grad

Descripsion:
  In deep learning framework, auto-grad is a useful feature. Auto-grad can make back propagation more convenience when you are buiding your own neural network.
 Now, Doge Head is learning deep learning, he thinks that he can achieve a simple auto-grad module: polynomial auto-grad. For example, in your network, the polynomial is “ 3 x 4 + 0 x 3 + 1 x 2 + 5 x 1 + 1 3x^4 + 0x^3 +1x^2 + 5x^1 + 1 3x4+0x3+1x2+5x1+1”, the auto-grad result is" 12 x 3 + 0 x 2 + 2 x 1 + 5 12x^3 + 0x^2 +2x^1 + 5 12x3+0x2+2x1+5".
Input:
 Multi test case. First line contains a single number T indicates cases number. For each test case:
 First line contains a single number N, indicates the maximum exponent of polynomial.
 Second line contains (N + 1) numbers a 1 . . . a n a_1 ... a_n a1...an a n + 1 a_{n + 1} an+1, indicates coefficient of polunomial.

1 ≤ T ≤ 10 1 \leq T \leq 10 1T10
1 ≤ N ≤ 100000 1 \leq N \leq 100000 1N100000
0 ≤ 0 \leq 0 a i a_i ai ≤ 100000 \leq 100000 100000

Output:
 For each test case, output N numbers in one line, separated by spaces, indicates the result of auto-grad for the given polynomial. (You should output all coefficients even some coefficients are 0.)

Sample Input Sample Output
2
4
0 1 1 1 1
8
1 1 1 1 2 2 2 2 2
0 3 2 1
8 7 6 5 8 6 4 2

Hints:
None

Answer:

#include 
using namespace std;

int num, e;
bool Bool = true;
int num1, e1;
int a[100001];
int b[100001];

int main(){
	while (1){
		cin >> num1;
		if (num1 >= 1 && num1 <= 10){
			num = num1;
			break;
		}
	}

	while(1){
		Bool = true;
		while(1){
			//cout <<"e1"<> e1;
			if(e1 >= 1 && e1 <= 100000){
				e = e1;
				break;
			}
		}

		while(Bool){

			for (int i = 0; i < e + 1; i++){
				cin >> b[i];
			}

			for (int i = 0; i < e + 1;i ++){
				if (b[i] < 0 || b[i] > 100000)
					Bool = true;
				else
					for(int i = 0; i < e + 1; i ++)
						a[i] = b[i];
					Bool = false;
			}

			for (int m = 0; m < e ; m ++){
				cout << b[m] * (e - m) << " ";
			}

			}		
	}
	return 0;
}

你可能感兴趣的:(天津大学2019ACM新生赛)