Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = 1000; % start of search interval
- b = 1000; % end of search interval
- lvls = [24,11,5]; % possible level steps in reverse order
- for n = (a:b)
- res = [0,0,0];
- found=false;
- for x = (floor(n/lvls(1)):-1:0)
- for y = (floor(n/lvls(2)):-1:0)
- for z = (floor(n/lvls(3)):-1:0)
- if (dot([x,y,z], lvls) == n)
- res = [x,y,z];
- found = true;
- break;
- end
- end
- if (found) break; end
- end
- if (found) break; end
- end
- display('-----');
- display(n);
- if (found)
- display(res);
- display('cost (in EUR):')
- display(dot([8.95,4.50,2.25],res))
- else
- display("Nothing found");
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement