You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.4 KiB

2 years ago
#include <bits/stdc++.h>
using namespace std;
int m; // 初始魔法值
int s; // 他所在的初始位置与岛的出口之间的距离
int t; // 岛沉没的时间
int d; // 守望者在剩下的时间内能走的最远距离
int main() {
cin >> m >> s >> t;
for (int i = 1; i <= t; i++) { // 枚举每一秒
if (s - d <= 17) { // 如果距离小于17那么可以在1秒内跑步走完不用再等魔法值恢复
cout << "Yes" << endl; // 说明可以走出去
cout << i << endl; // 输出需要几秒
return 0;
}
if (i == t && m < 10) { // 时间到达最后1秒还剩下1秒的时间并且不足以进行一次闪烁
cout << "No" << endl;
cout << d + 17 << endl; // 这1秒跑步吧
return 0;
}
if (m >= 10) { // 能闪烁尽量闪烁
m -= 10; // 用一次闪烁魔法值就减少10个
d += 60; // 能跑60米
} else
m += 4; // 本秒用于回血1秒可以恢复4个血
if (d >= s) {
cout << "Yes" << endl; // 说明可以走出去
cout << i << endl; // 输出需要几秒
return 0;
}
}
cout << "No" << endl; // 走不出去
cout << d << endl; // 最远可以走到d这个位置上
return 0;
}