1010. One-element polynomial derivation (25) time limit of MS
Memory Limit 32000 KB
Code length limit 8000 B
The Standard of the Judgment procedure
The design function asks for the derivative of the unary polynomial.
Input format: Enter the polynomial non 0 coefficients and indices (integers with an absolute value of not more than 1000) in an exponential degradation manner. Numbers are separated by spaces.
Output format: The coefficients and indices of the derivative polynomial not 0 items are output in the same format as the input. Numbers are separated by spaces, but there are no extra spaces at the end. Input Sample:
3 4-5 2 6 1-2 0
Output Sample:
12 3-10 1 6 0
Submitting Code
#include <stdlib.h>
#include <string.h>
#include <iostream>
using namespace std;
int main ()
{
int a,b;
int flag = 0;
b = 1;
while (cin>>a>>b)
{
if (b>0)
if (flag ==0)
{
cout<<a*b<< ' < <b-1;
flag = 1;
}
else
cout<< ' <<a*b<< ' <<b-1;
}
if (flag ==0)
cout<< "0 0";
System ("pause");
return 0;
}