Skip to content

Commit b69cb45

Browse files
Add files via upload
1 parent bbeeb6f commit b69cb45

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

karate.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main() {
5+
int t;
6+
cin>>t;
7+
while(t--){
8+
int n,s1,s2,s3,s4;
9+
cin>>n>>s1>>s2>>s3>>s4;
10+
if(s1>=s2){
11+
cout<<0<<endl;continue;
12+
}
13+
if(s3<=0){
14+
cout<<"FAIL"<<endl;continue;
15+
}
16+
int ans=0;
17+
int count=1;
18+
while(s1<s2 && ans<n){
19+
s1+=s3;
20+
count++;
21+
ans++;
22+
if(count==5){
23+
s1-s4;count=1;
24+
}
25+
}
26+
if(ans==n && s2 > s1){
27+
cout<<"FAIL"<<endl;
28+
}
29+
else{
30+
cout<<ans<<endl;
31+
}
32+
}
33+
return 0;
34+
}

0 commit comments

Comments
 (0)