题目网址:Plants vs Zombies杂交版01:阳光向日葵问题
我的代码:
#include<bits/stdc++.h>
using namespace std;
int t[721],time0,n,i,j,cometime=1;
int times(int times1,int suns)
{
if(times1<1)return suns;
int sun=suns;
for(j=1;j<=n;j++)
{
if((cometime-t[j])<12)
{
if((t[j]>=cometime)&&(cometime-t[j])<120)sun+=25;
else if(t[j]>=cometime)sun+=75;
else
continue;
}
else if((cometime-t[j])==12)sun+=40;
}
return times((times1-1),suns);
}
int main()
{
scanf("%d%d",&n,&time0);
for(i=1;i<=n;i++)
{
scanf("%d",&t[i]);
};
printf("%d",times(time0,0));
return 0;
}