赞
踩
- #include <cmath>
- #include <cstdio>
- #include <algorithm>
- #include <iostream>
- using namespace std;
-
- int v1,v2,t,s,L;
- int s1,t1,s2,t2;
-
- int main()
- {
- scanf("%d %d %d %d %d",&v1,&v2,&t,&s,&L);
- t1+=1;
- t2+=1;
- s1=s1+v1;
- s2=s2+v2;
- while(true)
- {
- if(s1==L&&s2==L)
- {
- cout<<"D"<<endl;
- cout<<t1<<endl;
- break;
- }
- if(s1==L)
- {
- cout<<"R"<<endl;
- cout<<t1<<endl;
- break;
- }
- if(s2==L)
- {
- cout<<"T"<<endl;
- cout<<t2<<endl;
- break;
- }
- if(s1-s2>=t)
- {
- t1+=s;
- // t2+=s; //不能这样写,因为在这过程中可能跑过终点了
- // s2=s2+v2*s;
- for(int i=1;i<=s;i++)
- {
- t2+=1;
- s2+=v2;
- if(s2==L)
- {
- cout<<"T"<<endl;
- cout<<t2<<endl;
- exit(0);
- }
-
- }
- }
- else
- {
- t1+=1;
- t2+=1;
- s1=s1+v1;
- s2=s2+v2;
- }
-
- }
-
- return 0;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。