- #1
fireflies
- 210
- 12
<< Mentor Note -- Posts edited to add code tags for better readability >>
Hello everyone-
The vjudge problem link is: http://www.lightoj.com/volume_showproblem.php?problem=1006
My solution is:
I got several wrong answers...
In the forum there is said: http://www.lightoj.com/forum_viewtopic.php?topic=193
A critical input output is:
Input:
1
10000007 0 0 0 0 0 0
Output:
Case 1: 0
I don't understand this... Can anyone help?? (edit: I got it... and edited the code. But still wrong answer. Can anybody tell me why?)[/I]
Hello everyone-
The vjudge problem link is: http://www.lightoj.com/volume_showproblem.php?problem=1006
My solution is:
C:
#include <iostream>
using namespace std;
long long int arr[10001];
long long int a,b,c,d,e,f;
long long int F(int n)
{
if(n==0)
{
arr[n]=a;
return arr[n];
}
if(n==1)
{
arr[n]=b;
return arr[n];
}
if(n==2)
{
arr[n]=c;
return arr[n];
}
if(n==3)
{
arr[n]=d;
return arr[n];
}
if(n==4)
{
arr[n]=e;
return arr[n];
}
if(n==5)
{
arr[n]=f;
return arr[n];
}
if(arr[n]!=-1)
return arr[n];
arr[n]=F(n-1) + F(n-2) + F(n-3) + F(n-4) + F(n-5) + F(n-6);
return arr[n];
}
int main()
{
int cas;
cin>>cas;
for(int i=1; i<=cas; i++)
{
int n;
cin>>a>>b>>c>>d>>e>>f>>n;
for(int i=0;i<=n;i++)
arr[I]=-1;
long long int result=F(n)%10000007;
cout<<"Case "<<i<<": "<<result<<"\n";
}
return 0;
}
I got several wrong answers...
In the forum there is said: http://www.lightoj.com/forum_viewtopic.php?topic=193
A critical input output is:
Input:
1
10000007 0 0 0 0 0 0
Output:
Case 1: 0
I don't understand this... Can anyone help?? (edit: I got it... and edited the code. But still wrong answer. Can anybody tell me why?)[/I]
Last edited by a moderator: