1010 一元多项式求导 (25分)
https://pintia.cn/problem-sets/994805260223102976/problems/994805313708867584
#include <iostream> #include <cstdio> #include <cstring> #include <string> #include <cmath> #include <algorithm> #include <vector> using namespace std; int main() { bool flag=true; int count=0,num; vector<int> vec; while(cin>>num) vec.push_back(num); for(int i=1;i<vec.size();i+=2){if(vec[i]!=0) flag=false;} if(flag) cout<<"0 0"; else { for(int i=0;i<vec.size()-1;i++) { if(i%2==0&&vec[i+1]!=0) { vec[i]=vec[i]*vec[i+1]; vec[i+1]=vec[i+1]-1; if(i==0) cout<<vec[i]<<" "<<vec[i+1]; else cout<<" "<<vec[i]<<" "<<vec[i+1]; } } } return 0; }