Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- using namespace std;
- int sol[11],n,k=1, a, b;
- void init(int k)
- {
- sol[k]=a-1;
- }
- int succesor(int k)
- {
- if(sol[k]<b)
- {
- sol[k]++;
- return 1;
- }
- return 0;
- }
- void tipar(int k)
- {
- for(int i=1; i<=n; i++)
- cout<<sol[i];
- cout<<endl;
- }
- void Back(int k)
- {
- if(k==n+1)
- tipar(k);
- else
- {
- init(k);
- while(succesor(k))
- Back(k+1);
- }
- }
- int main()
- {
- cin>>a>>b>>n;
- Back(1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement