Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main ()
- {
- int n, s, c;
- while(scanf("%d",&n) != EOF){
- c=n,s=0;
- for(;;){
- if(n<3) break;
- s+=n%3;
- n=n/3;
- c+=n;
- }
- printf("%d\n",s+c);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement