<span style="font-size:18px;">#include<iostream> #include<iterator> #include<algorithm> #include<time.h> #include<vector> using namespace std; /* *整数因子分解问题 */ vector<int> vec; static int Count = 0; void solve(int n) { if(1==n) { cout<<"第"<<++Count<<"种分解: "; copy(vec.begin(),vec.end(),ostream_iterator<int>(cout," ")); cout<<endl; } for (int i = 2; i <= n; i++) { if(0==n%i) { vec.push_back(i); solve(n/i); vec.pop_back(); } } } int main() { int n; long start,end; cin>>n; start = clock(); solve(n); end = clock(); cout <<"程序执行时间(单位:毫秒): "<< end-start <<endl; }</span>