We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Mathematics
- Fundamentals
- Restaurant
- Discussions
Restaurant
Restaurant
Sort by
recency
|
256 Discussions
|
Please Login in order to post a comment
My code in Java 15:
Easy one in C++, just using the GCD:
my solution is
public static int restaurant(int l, int b) { return (l * b) / (int) Math.pow(findGcd(l, b), 2); }
It's just a basic math problem. GCD to get the side of the smaller sub-squares, get the area (power of 2), and divide the big area by the area of the squares.