|
|
back to boardAnyone can tell me why is not working? (Test 4 Wrong answer) #include <iostream> using namespace std; long long maxi,sum=1,sum1=1,n,a,b,i,v[100000],v1[100000]; int main() { cin>>n>>a>>b; if(a>b) maxi=a; else maxi=b; v[maxi]=1; v1[maxi]=1; for(i=maxi+1;i<n+maxi;i++) { v[i]=sum1; v1[i]=sum; sum=sum+v[i]-v[i-a]; sum1=sum1+v1[i]-v1[i-b]; } cout<<sum+sum1; return 0; } |
|
|