蒟蒻觉得贪心解法应该没啥好讲滴
#include <bits/stdc++.h>
using namespace std;
int main(){
int m,s,t,minv=2e9,maxv=0,k,temp,m1,t1,i;
bool flag=false;
cin >> m >> s >> t;
for(i=t; i>=0; i--){
m1=m+4*i;
t1=m1/10;
if (t1>t) t1=t;
if (t-t1-i<0) continue;
temp=t1*60+(t-t1-i)*17;
if (temp>s){
flag=true;
k=t-t1-i;
while (k>0 && temp-17>s){
k--;
temp -=17;
}
minv=min(minv, k+i+t1);
}
maxv=max(maxv, temp);
}
if (flag){
cout << "Yes" << endl;
cout << minv;
}
else {
cout << "No" << endl;
cout << maxv;
}
return 0;
}