#include <iostream> using namespace std; int main(){ int n; cin>>n; while (n){ long long x=1,ans=0,k; cin>>k; while (k){ ans+=k%2*x; x*=3; k/=2; } cout<<ans<<endl; --n; } return 0; }
7
8
2015
8
2015
#include <iostream> using namespace std; int main(){ int n; cin>>n; while (n){ long long x=1,ans=0,k; cin>>k; while (k){ ans+=k%2*x; x*=3; k/=2; } cout<<ans<<endl; --n; } return 0; }
Host by is-Programmer.com | Power by Chito 1.3.3 beta | Theme: Aeros 2.0 by TheBuckmaker.com