Advertisement
a53

cifre_c1c2

a53
Oct 8th, 2019
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #define NR 1000
  3. using namespace std;
  4. int c1,c2,x[NR],n;
  5.  
  6. void afis()
  7. {
  8. int NR1=0;
  9. for(int i=1;i<=n;i++)
  10. if(x[i])
  11. ++NR1;
  12. if(NR1==c1)
  13. {
  14. for(int i=1;i<=n;i++)
  15. if(x[i])
  16. cout<<c2;
  17. else
  18. cout<<c1;
  19. cout<<'\n';
  20. }
  21. }
  22.  
  23. void back(int k)
  24. {
  25. for(int i=0;i<=1;++i)
  26. {
  27. x[k]=i;
  28. if(k==n)
  29. afis();
  30. else
  31. back(k+1);
  32. }
  33. }
  34.  
  35. int main()
  36. {
  37. cin>>c1>>c2;
  38. if(c1>c2)
  39. swap(c1,c2);
  40. n=c1+c2;
  41. back(1);
  42. return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement