Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- long long N,n,a,b,c,d,e,f,g,h,i,j,k,l,m,o,p,q,r,sum;
- while(scanf("%lld",&N)==1)
- {
- if(N==0)
- {
- break;
- }
- n=N;
- a=n%3;
- if(a==0)
- b=n+1;
- if(a==1)
- b=n+1;
- if(a==2)
- b=n+1;
- c=b/3;
- d=b%3;
- e=c+d;
- f=e/3;
- g=e%3;
- h=f+g;
- i=h/3;
- j=h%3;
- k=i+j;
- l=k/3;
- m=k%3;
- r=l+m;
- o=r/3;
- p=r%3;
- q=o+p;
- sum=c+f+i+l+o;
- if(a==1)
- sum=sum;
- if(a==2)
- sum=sum;
- printf("%lld\n",sum);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment