2 solutions
-
0
#include<bits/stdc++.h> using namespace std; int main(){ int v1,v2,t,s,l; cin>>v1>>v2>>t>>s>>l; int t_W=0; int t_R=0; int dis_R=0; int dis_W=0; while(dis_R<l&&dis_W<l){ int k=dis_R-dis_W; if(k>=t){ dis_W+=s*v2; t_R+=s; t_W+=s; continue;//很重要,不然只能跑80%数据,跳到下次循环 } dis_R+=v1; dis_W+=v2; t_R++; t_W++; } if(dis_R<l){ cout<<"T"<<endl; cout<<t_W; }else if(dis_W<l){ cout<<"R"<<endl; cout<<t_R; } else cout<<"D"<<endl<<t_W; return 0; }
Information
- ID
- 6819
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 8
- Tags
- # Submissions
- 67
- Accepted
- 11
- Uploaded By