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.
|
|
|
|
#include <bits/stdc++.h>
|
|
|
|
|
using namespace std;
|
|
|
|
|
int m; // 初始魔法值
|
|
|
|
|
int s; // 他所在的初始位置与岛的出口之间的距离
|
|
|
|
|
int t; // 岛沉没的时间
|
|
|
|
|
int d; // 守望者在剩下的时间内能走的最远距离
|
|
|
|
|
|
|
|
|
|
// 贪心思路,可能过 5/11
|
|
|
|
|
int main() {
|
|
|
|
|
cin >> m >> s >> t;
|
|
|
|
|
for (int i = 1; i <= t; i++) { // 枚举每一秒
|
|
|
|
|
if (m >= 10) { // 如果剩余魔法值大于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;
|
|
|
|
|
}
|