贪心 80tps 求条
查看原帖
贪心 80tps 求条
1411457
min25楼主2024/10/25 09:49
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e6 + 10;
ll m, s, t, now;
int main () {
	cin >> m >> s >> t;
	now = s;
	for (int i = 1; i <= t; ++ i) {
		if (m >= 10) {
			now -= 60;
			m -= 10;
		}
		else {
			ll tm = (10 - m) % 4 == 0 ? (10 - m) / 4 : (10 - m) / 4 + 1;
			ll ts = tm * 17;
			ll p = (now % 17 == 0) ? now / 17 : now / 17 + 1;
			if (p < tm && i + p <= t) {
				now -= 17;
			}
			else if (ts < 60 && i + tm < t) {
				m += 4;
			}
			else {
				now -= 17;
			}
		}
		if (now < 0) {
			cout << "Yes\n" << i << '\n';
			return 0;
		}
	}
	cout << "No\n" << s - now << '\n'; 
	return 0;
}
2024/10/25 09:49
加载中...