Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define pb push_back
- #define fo(n) for(int i=0;i<n;i++)
- int main(){
- int n;
- while( cin >> n && n >= 0 ){
- vector<int> p;
- if( !n ){
- cout << '0' << endl;
- continue;
- }
- while( n ){
- int tmp = n % 3;
- p.pb( tmp );
- n /=3;
- }
- for( int i = p.size() - 1 ; i > -1 ; --i ) cout << p[i];
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement