洛谷题号:P1095
参考题解:作者: 究极龙骑士 更新时间: 2017-07-11 22:44 https://www.luogu.org/wiki/show?name=%E9%A2%98%E8%A7%A3+P1095
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #include<iostream> #include<cstdio> #include<string> #include<algorithm> #include<queue> #include<map> #include<list> #include<cstring> #include<cassert> #include<cmath> using namespace std; int m, s, t; int main(){ ios::sync_with_stdio(false); cin >> m >> s >> t; int s1 = 0, s2 = 0;//s1跑步,s2瞬间移动 for (int time = 1; time <= t; time++){ s1 += 17; if (m >= 10){ m -= 10; s2 += 60; } else{ m += 4; } if (s1 < s2)s1 = s2; if (s1> s){ cout << "Yes" << endl << time << endl; return 0; } } cout << "No" << endl << s1 << endl; return 0; } |