- 2023暑假NOIP模拟赛1
50pts
- 2023-8-8 16:33:07 @
#include<bits/stdc++.h> #define ll long long using namespace std; int main() { int v1,v2,t,s,l; int timeT=0; int L1=0,L2=0; cin>>v1>>v2>>t>>s>>l; while(L1!=l&&L2!=l) { L1+=v1; L2+=v2; timeT++; if(L1-L2>=5) { L2+=s*v2; timeT+=s; } } if(L1l&&L2!=l) cout<<"R"<<endl; else if(L2l&&L1!=l) cout<<"T"<<endl; else if(L1l&&L2l) cout<<"D"<<endl; cout<<timeT; return 0; }
3 comments
-
Csvoner LV 3 SU @ 2023-8-9 17:10:38
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); // 兔子速度:v1米/秒,领先 t 米或以上就休息 s 秒 // 乌龟速度:v2米/秒 // 赛道长度:l 米 int v1, v2, t, s, l; cin >> v1 >> v2 >> t >> s >> l; // 当前时间(秒),当前兔子跑了的距离,当前乌龟跑了的距离 int nowTime, nowR, nowT, resTime; nowTime = 0; nowR = 0; nowT = 0; while (nowR < l && nowT < l) { if (nowR - nowT < t) { nowR += v1; nowT += v2; nowTime += 1; } else { nowR += 0; nowT += v2 * s; nowTime += s; } } if (nowR >= l && nowT >= l) { cout << "D\n"; cout << nowTime << "\n"; } else if (nowR >= l) { cout << "R\n"; cout << nowTime << "\n"; } else if (nowT >= l) { cout << "T\n"; cout << l / v2 << "\n"; } return 0; }
-
2023-8-9 17:06:31@
龟兔赛跑预测
-
2023-8-8 16:33:47@
#define ll long long using namespace std; int main() { int v1,v2,t,s,l; int timeT=0; int L1=0,L2=0; cin>>v1>>v2>>t>>s>>l; while(L1!=l&&L2!=l) { L1+=v1; L2+=v2; timeT++; if(L1-L2>=5) { L2+=s*v2; timeT+=s; } } if(L1==l&&L2!=l) cout<<"R"<<endl; else if(L2==l&&L1!=l) cout<<"T"<<endl; else if(L1==l&&L2==l) cout<<"D"<<endl; cout<<timeT; return 0; }`````这里重新发下
- 1