File tree 1 file changed +47
-0
lines changed
1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < bits/stdc++.h>
2
+ using namespace std ;
3
+
4
+ void solve (int myspeed, int topRacer, int drugBoost, int druglimit){
5
+ int drugUsed = 0 ;
6
+ while (true ){
7
+ if (drugUsed > druglimit){
8
+ cout<<" No" <<endl;
9
+ break ;
10
+ }
11
+ if (myspeed > topRacer && drugUsed < druglimit){
12
+ cout<<" Yes" <<endl;
13
+ break ;
14
+ }
15
+ else if (drugBoost <= 0 ){
16
+ cout<<" No" <<endl;
17
+ break ;
18
+ }
19
+ else {
20
+ drugUsed += 1 ;
21
+ myspeed += drugBoost;
22
+
23
+ }
24
+ }
25
+ }
26
+ int main (int argc, char const *argv[])
27
+ {
28
+ int t;
29
+ cin>>t;
30
+
31
+ while (t--){
32
+ int n, k, l;
33
+ cin>>n>>k>>l;
34
+ int part;
35
+ int maxVal = 0 ;
36
+ for (int i = 1 ; i <= n-1 ; i+=1 ){
37
+ int temp;
38
+ cin>>temp;
39
+ if (temp > maxVal){
40
+ maxVal = temp;
41
+ }
42
+ }
43
+ cin>>part;
44
+ solve (part, maxVal, k, l);
45
+ }
46
+ return 0 ;
47
+ }
You can’t perform that action at this time.
0 commit comments