How to check whether bricks of different sizes to make the chain the right length?

Hello. Trying to solve the problem makeBricks on codingbat.com. And I can't understand how it can be solved without loops. Statement of the problem:
We want to make a row of bricks that is goal inches long. We have a number of small bricks (1 inch each) and big bricks (5 inches each). Return true if it is possible to make the goal by choosing from the given bricks. This is a little harder than it looks and can be done without any loops.

makeBricks(3, 1, 8) → true
makeBricks(3, 1, 9) → false
makeBricks(3, 2, 10) → true

I need tips, not ready-made solutions (turnkey solutions I can Google, but I want to solve the problem yourself).

PS still managed to solve the problem with two cycles. I tried using recursion, but if the incoming numbers are large, it crashes with a stack overflow.
June 5th 19 at 22:01
June 5th 19 at 22:03
Solution
You need to compare how much as much as the big need for a given length and whether you have a sufficient number of little ones to "finish off" to the desired amount

spoiler
``````public class HelloWorld{

public static void main(String []args){
System.out.println(calc(3, 1, 8));
System.out.println(calc(3, 1, 9));
System.out.println(calc(3, 2, 10));
}

public static boolean calc(int small, int big, int len){
int xxx = len / 5;
int yyy = len % 5;

return xxx <= big && yyy <= small;
}
}``````

? =) - Gretchen40 commented on June 5th 19 at 22:06
``````int xxx=Math.min(len/5,big);
int yyy=len-5*xxx;
return (yyy<=small);``````
- sadie_Hop commented on June 5th 19 at 22:09
really. thanks for the case! - Marcia_Hills91 commented on June 5th 19 at 22:12
June 5th 19 at 22:05
I'm so sorry :-D

// why would you tip, if you can Google a ready-made solution itself? then run it in reverse order - you will receive tips, will make some patterns for solving such problems, you will find other tasks and try to solve it. go for a toaster to write cocoa description of the issue (Yes, you didn't even mention that in the arguments makeBricks and what they order), will receive again a link to the finished solution and the circle closes.
Well, as I wrote, I need tips, not solutions. - Gretchen40 commented on June 5th 19 at 22:08