The design function is to find the derivative of the polynomial of one element. (Note: The first-order derivative of xn (n is an integer) is n*xn-1. )
input format: input polynomial non-0 coefficients and exponents in exponential degradation (absolute values are integers not exceeding 1000). The numbers are separated by a space.
output format: outputs the coefficients and exponents of the derivative polynomial not 0 in the same format as the input. The numbers are separated by a space, but cannot have extra spaces at the end. Note that the exponent and coefficients for the "0 polynomial" are 0, but are expressed as "0 0".
Input Sample:
3 4-5 2 6 1-2 0
Sample output:
12 3-10 1) 6 0
1 ImportJava.io.BufferedReader;2 Importjava.io.IOException;3 ImportJava.io.InputStreamReader;4 5 Public classMain6 {7 Public Static voidMain (string[] args)throwsIOException8 {9BufferedReader buf=NewBufferedReader (NewInputStreamReader (system.in));TenString line=buf.readline (); OneString[] Temp=line.split (""); A int[][]a=New int[TEMP.LENGTH/2] [2]; - for(inti=0;i<a.length;i++) - { theA[i][0]=integer.parseint (temp[2*i]); -A[i][1]=integer.parseint (temp[2*i+1]); - } - + int[][]b=New int[TEMP.LENGTH/2] [2]; - intJ=0; + for(inti=0;i<a.length;i++) A { at if(a[i][1]==0) - Continue; -B[j][0]=a[i][0]*a[i][1]; -B[j][1]=a[i][1]-1; -J + +; - } in if(j==0) -System.out.println ("0 0"); to Else + { - for(inti=0;i<j-1;i++) theSystem.out.print (b[i][0]+ "" +b[i][1]+ ""); *System.out.println (b[j-1][0]+ "" +b[j-1][1]); $ }Panax Notoginseng - } the}
02-Linear Structure 1. Derivation of one-dimensional polynomial (25)