#include <iostream>
#define l1 v1 * i1
#define l2 v2 * i2
using namespace std;
int main(){
int v1, v2, t, s, l;
cin >> v1 >> v2 >> t >> s >> l;
// v1 = 10;
// v2 = 3;
// t = 20;
// s = 15;
// l = 3450;
// cout << v1 <<" "<< v2 <<" "<< t <<" "<< s <<" "<< l <<endl;
int flag = 0, i1 = 1, i2 = 1;
while(l1 < l && l2 < l){
// cout << "第" << i2 << "秒:" << "i1:" << i1 << "; i2:"<< i2 << "; flag:"<< flag << endl;
// cout << " 兔子跑了"<<v1*i1<<" 乌龟跑了"<<v2*i2<<endl;
if(l1 - l2 >= t && flag <= 0) flag = s;
if(flag > 0) i1--;
flag--;
i1++;
i2++;
}
// cout << "循环完成" << endl;
// cout << "第" << i2 << "秒:" << "i1:" << i1 << "; i2:"<< i2 << "; flag:"<< flag << endl;
if(l1 > l2){
cout << "R" << endl << i2;
}else if(l1 < l2){
cout << "T" << endl << i2;
}else if(l1 == l2){
cout << "D" << endl << i2;
}
return 0;
}
蓝桥题目:B-24、龟兔赛跑预测
最新推荐文章于 2024-03-06 21:46:08 发布