ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1079. Maximum

WA on test 4
Posted by abid1729 22 Jun 2019 13:45
what is test 4. plz help me.
my code is below
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long n=1000,i,k;
    long long a[100000];
    a[0]=0,a[1]=1;
    for(i=2;i<n;i=i+2){
            k=i/2;
        a[i]=a[k],a[i+1]=a[k]+a[k+1];
    }
    cin>>n;
    while(n){
            cout<<*max_element(a,a+n+1)<<endl;
        cin>>n;
    }
}

Edited by author 22.06.2019 13:46