User info | |
---|---|
User name: | mhe33 |
Name: | me |
Bio: | # include <iostream>
using namespace std; int count=0; int functime=0; void nmN(int a[],int m,int n,int size){ functime++; while(m>0){ a[size-1]=m; if(size==1){ for(int j=0;j<n;j++){ cout << a[j]<<" ";} count++; cout<<endl; } else{ nmN(a,m,n,size-1); } m--; } } int main(){ int n; cout <<"n: \n"; cin >> n; int m; cout << "m:\n"; cin>>m; int * a=new int[n]; nmN(a,m,n,n); cout << "Count: " << count << endl; cout << "Function time: " << functime << endl; system("pause"); return 0; } int count=0; void printsub(int a[],int sizea,int n,int k){ if(k>n){return;} while(n>0){ a[k-1]=n; if(k==1){ for(int j=0;j<sizea;j++){ cout << a[j]<<" ";} cout<<endl; count++; } else{ printsub(a,sizea,n-1,k-1); } n--; } } |
History | |
Joined: | |
Number of posts: | 4 |
Latest posts: |
This user does not accept Private Messages