1010. One-element polynomial derivation (25)--a record of the problem

Source: Internet
Author: User

1010. One-element polynomial derivation (25) time limit of MS
Memory Limit 65536 KB
Code length limit 8000 B
The Standard of the Judgment procedure

The design function asks for the derivative of the unary polynomial. (Note: The first derivative of xn (n is an integer) is n*xn-1. )

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. Note that the "0 polynomial" index and coefficient are all 0, but the expression is "0 0". Input Sample:

3 4-5 2 6 1-2 0
Output Sample:
12 3-10 1 6 0

//  main.cpp
//  PATBase1010////
Created by Tong on  4/4/16.  copyright©2016 Tong. All rights reserved.

#include <iostream>

using namespace std;

int main (int argc, const char * argv[]) {
    //Insert code here ...
    
    int a, B;
    
    bool A = true;
    
    while (cin>>a>>b) {
        if (b!=0&&a!=0) {
            if (!first) {
                cout<< "";
            }
            cout<<a*b<< "" <<b-1;
            i = false;
        }
    
    if (a) {
        cout<< "0 0";
    }
    
    return 0;
}



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.