赞
踩
- /*
- **************************************************
- Title: 蓝桥杯练习题—— 龟兔赛跑预测
- **************************************************
- Date:2014/03/12
- **************************************************
- author:刘旭
- **************************************************
- */
- #include<iostream>
- using namespace std;
- int main()
- {
- int v1, v2, t, s, l;
- int l1,l2,t1,t2,time = 0;
- cin>>v1>>v2>>t>>s>>l;
- t1 = t2 = 0;
- l1 = l2 = 0;
- while(l1 < l && l2 < l)
- {
- if(l1 - l2 >= t)
- {
- t2 += s;
- l1 = v1 * t1;
- l2 = v2 * t2;
- }
- else
- {
- t1++;
- t2++;
- l1 = v1 * t1;
- l2 = v2 * t2;
- }
- }
- if(l1 == l2)
- cout<<"D"<<endl<<t2;
- else if(l1 > l2)
- cout<<"R"<<endl<<t2;
- else
- cout<<"T"<<endl<<l/v2;
- return 0;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。