http://codeforces.com/problemset/problem/333/A
同样是看清题目,英语真的很重要..
#include<bits/stdc++.h>
using namespace std;
int main(){
long long int n;
while(scanf("%I64d",&n)!=EOF)
{
long long int _3=3;
while(n%_3==0){
_3*=3;
}
long long int ans=n/_3+1;
cout<<ans<<endl;
}
return 0;
}