标签:acm
洞穴逃生Yes 1
直接贴通过代码
#include <iostream> using std::endl; using std::cin; using std::cout; int main() { int M,S,T; cin >> M >> S >> T; int distance=0; int flashdistance=0; int i; if(S==0) { cout << "Yes " << 0 << endl; }else if(T==0 && S!=0) { cout << "No " << 0 << endl; }else{ for(i=1;i<=T;++i) { distance+=17; if(M<10) { M+=4; }else{ flashdistance+=60; M-=10; } if(distance<flashdistance) distance = flashdistance; if(distance >= S) break; } if(i<=T) cout << "Yes " << i << endl; else cout << "No " << distance << endl; } return 0; }
第六届华为创新杯编程大赛-进阶1第1轮,布布扣,bubuko.com
标签:acm
原文地址:http://blog.csdn.net/computer_liuyun/article/details/25194553