https://www.luogu.org/problemnew/show/P1095
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int m,s,t,x1,x2,i;
int main()
{
scanf("%d%d%d",&m,&s,&t);
for (i = 1; i <= t; i++)
{
if (m >= 10)
{
x1+=60;
m-=10;
}
else
m += 4;
if (x1 > x2 + 17)
x2 = x1;
else
x2 += 17;
if (x2 >= s)
break;
}
if (i > t)
printf("No\n%d\n",x2);
else
printf("Yes\n%d\n",i);
}