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.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# 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 ;
}