Advertisement
STANAANDREY

28/102

Apr 14th, 2019
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.23 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.  
  7. int a[1000],p=0,m=0,n,i;
  8. cin>>n;
  9. a[0]=1;
  10. while (m<n)
  11. {
  12.     m++;a[m]=2*a[p]+1;
  13.     m++;a[m]=3*a[p]+1;
  14.     p++;
  15. }
  16. for (i=0;i<n;i++)
  17.     cout<<a[i]<<' ';
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement