Inspired by problem 2175.
A hungry matlab enthusiast has an orange. He decides to cut it into pieces using three dimensional grid.
Given grid density N please help him to find the number of ideal cubes full of juicy orange and the number of pieces containing also some peel.
Example: For N=3 matlab enthusiast is not satisfied. He gets [1 26]. Only one cube and 26 unpeeled pieces!
Related problems:
Perhaps I am misinterpreting, but it seems to me that some of your testsuite solutions are incorrect. For example, for N=5 I seem to be getting 19 instead of 27 cubes entirely within the sphere. I double-check using this code: x=rand(1e6,3); r=sum((x-.5).^2,2)
You are totally right. I've generated answers using my solution, which was wrong. My fault is I haven't examined it any other way. Considering N=5, there could fit inside the sphere only a 3x3x3 cube, but its space diagonal is 3*sqrt(3) which is bigger than 5, the diameter of sphere. So, there cannot be more than 27-8=19 cubes inside. Thanks, for pointing that out, Alfonso!
Fixed & rescored now. It leads now to smaller-size answers. Consider the fact that for some N (for example 6) there are some quasi-cubes containing a very small amount of peel from those ultra-thin-peel-sweet-juicy-ideal-oranges ;-)
Find the longest sequence of 1's in a binary sequence.
3229 Solvers
Project Euler: Problem 8, Find largest product in a large string of numbers
219 Solvers
Find the maximum number of decimal places in a set of numbers
272 Solvers
Remove from a 2-D matrix all the rows that contain at least one element less than or equal to 4
126 Solvers
2267 Solvers