forked from ravitomar7/Lab_Test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.java
More file actions
36 lines (31 loc) · 841 Bytes
/
test.java
File metadata and controls
36 lines (31 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
public class test
{
public static boolean makeBricks(int small, int big, int goal) {
int totalInches = small + big*5;
if(totalInches < goal){
return false;
}
int bigInches= big*5;
int smallRequired = goal %5;
if(smallRequired > small && bigInches != goal){
return false;
}else if(smallRequired <=small){
if( bigInches >= goal || smallRequired + bigInches == goal || small +bigInches ==goal
|| small+ bigInches == goal){
return true;
}if(bigInches + small > goal){
if(small > goal-bigInches){
return true;
}
}
}
return false;
}
}
class totest extends test
{
public static void main(String...args)
{
System.out.println(test.makeBricks(5, 10, 15));
}
}