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 <iostream>
|
|
|
|
|
using namespace std;
|
|
|
|
|
const int N = 300010;
|
|
|
|
|
int m; // 初始魔法值
|
|
|
|
|
int s; // 他所在的初始位置与岛的出口之间的距离
|
|
|
|
|
int t; // 岛沉没的时间
|
|
|
|
|
int f[N]; // f[i]数组表示第i秒时守望者所能到的最远距离
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
cin >> m >> s >> t;
|
|
|
|
|
for (int i = 1; i <= t; i++) { // 相当于第一次提交的程序
|
|
|
|
|
if (m >= 10) { // 能闪烁尽量闪烁
|
|
|
|
|
m -= 10;
|
|
|
|
|
f[i] = f[i - 1] + 60; // 最大距离可以增加60米
|
|
|
|
|
} else {
|
|
|
|
|
m += 4; // 不能闪烁,那么就站在原地回血
|
|
|
|
|
f[i] = f[i - 1]; // 距离没有长大
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 问题是站在原地回血不一定是最优选择,也可以在此时选择跑步啊~
|
|
|
|
|
for (int i = 1; i <= t; i++) {
|
|
|
|
|
f[i] = max(f[i], f[i - 1] + 17); // 如果在第i秒时跑步能到达更远距离,我们跑步
|
|
|
|
|
if (f[i] >= s) { // 已到达就可以输出+结束程序啦
|
|
|
|
|
cout << "Yes" << endl;
|
|
|
|
|
cout << i << endl;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
cout << "No" << endl;
|
|
|
|
|
cout << f[t] << endl; // 如果进行到了这里说明无法逃离,我们输出能到达的最远距离
|
|
|
|
|
return 0;
|
|
|
|
|
}
|