外站的一个题目,我提交上去只能对82%
题目链接
代码:
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
int v1,v2,t,s,l;
int re=0,len1=0,len2=0,time=0,f=0;
scanf("%d%d%d%d%d",&v1,&v2,&t,&s,&l);
while(len1<l&&len2<l) {
if(len1-len2>=t&&f==0) {
len2+=v2*s;
time+=s;
f=1;
} else {
len1+=v1;
len2+=v2;
time++;
f=0;
}
}
if(len1>=l&&len2<l)
printf("R\n");
else if(len1<l&&len2>=l)
printf("T\n");
else
printf("D\n");
printf("%d",time);
return 0;
}