You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
399 B

#include<bits/stdc++.h>
using namespace std;
int main() {
int v1,v2,t,s,m=0,l,i=0,L1=0,L2=0;
scanf("%d %d %d %d %d",&v1,&v2,&t,&s,&l);
while(l) {
i++;
if(m==0) {
if((L1-L2)>=t) {
m=s-1;
} else {
L1+=v1;
}
} else {
m--;
}
L2+=v2;
if(L1==l||L2==l) {
l=0;
}
}
if(L1>L2)printf("R\n%d",i);
else if(L1<L2)printf("T\n%d",i);
else printf("D\n%d",i);
return 0;
}