Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int n,a[100005],i,j,max;
- a[0]=0;
- a[1]=1;
- for(i=2;i<100000;i++){
- j=i/2;
- if(i%2==0){
- a[i]=a[j];
- }
- else{
- a[i]=a[j]+a[j+1];
- }
- }
- for(i=1;i<=10;i++){
- max=0;
- scanf("%d",&n);
- if(n==0) break;
- for(j=0;j<=n;j++){
- if(max<a[j])
- max=a[j];
- }
- printf("%d\n",max);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement