http://www.luogu.org/problem/show?pid=1095
第一次循环让守望者只能闪烁,然后第二次循环让守望者只能跑步,比较两次的长短即可
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
#define ms(i,j) memset(i,j, sizeof i);
using namespace std;
int f[300005];
int main()
{
int m,s,t;
scanf("%d%d%d", &m, &s, &t);
f[0] = 0;
for (int i=1;i<=t;i++)
{
if (m<10)
{
f[i] = f[i-1];
m += 4;
}else {m -= 10; f[i] = f[i-1]+60;}
}
for (int i=1;i<=t;i++)
{
f[i] = max(f[i], f[i-1]+17);
if (f[i]>=s)
{
printf("Yes\n%d", i);
return 0;
}
}
printf("No\n%d", f[t]);
return 0;
}