这是我刚写的大法师,但把走路的顺序放到闪现前面就会WA%60,这是为什么,求指教
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int M,S,T,ans=0x3f3f3f3f;
int f[300001];
void dfs(int s,int t,int m)
{
if(t>T)return;
if(f[t]>=s)return;
if(t>ans)return;
f[t]=s;
if(s>=S)ans=min(ans,t);
if(m>=10)
{
dfs(s+60,t+1,m-10);//闪现
}
else
{
dfs(s,t+1,m+4);//休息
}
dfs(s+17,t+1,m);//走路
}
void input()
{
scanf("%d%d%d",&M,&S,&T);
}
int main()
{
input();
memset(f,-0x3f3f3f3f,sizeof(f));
dfs(0,0,M);
if(ans<=T)
{
printf("Yes\n%d",ans);
}
else
{
printf("No\n%d",f[T]);
}
return 0;
}