We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bbeeb6f commit b69cb45Copy full SHA for b69cb45
karate.cpp
@@ -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