Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void rec(int n)
- {
- if(n>0)
- {
- rec((n+1)/3);
- if(n%3==0)
- cout<<0;
- else
- if(n%3==1)
- cout<<1;
- else
- cout<<"T";
- }
- }
- int main()
- {
- int n;
- cin>>n;
- if(n)
- rec(n);
- else
- cout<<0;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement