Skip to content

Commit 10f63df

Browse files
authored
Create BreakingBricks.cpp
1 parent 5bb337c commit 10f63df

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include <iostream>
2+
using namespace std;
3+
int main() {
4+
int t;
5+
cin>>t;
6+
while(t--) {
7+
8+
int s,w1,w2,w3;
9+
cin>>s>>w1>>w2>>w3;
10+
int sum = w1 + w2 + w3;
11+
if(s >= sum) {
12+
cout<<"1"<<endl;
13+
}
14+
else {
15+
int sum1 = w1+w2;
16+
int sum2 = w2+w3;
17+
if(s >= sum1 || s >= sum2)
18+
cout<<"2"<<endl;
19+
else
20+
cout<<"3"<<endl;
21+
}
22+
}
23+
return 0;
24+
}

0 commit comments

Comments
 (0)