Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- long long N,i,M,A,a,b,c,d,e,f,P,Q;
- while(scanf("%lld",&N)==1)
- {
- if(N<0)
- break;
- if(N==0)
- {
- M=0;
- A=1;
- printf("%lld %lld\n",M,A);
- }
- if(N==1)
- {
- M=1;
- A=2;
- printf("%lld %lld\n",M,A);
- }
- if(N>=2)
- {
- M=1;
- A=2;
- a=0;
- b=1;
- d=1;
- e=1;
- for(i=2;i<=N;i++)
- {
- c=a+b;
- a=b;
- b=c;
- Q=M+c;
- M=Q;
- }
- printf("%lld ",Q);
- for(i=2;i<=N;i++)
- {
- f=d+e;
- d=e;
- e=f;
- P=A+f;
- A=P;
- }
- printf("%lld\n",P);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement