 # opt

Dec 13th, 2015
88
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. [3:43:20 PM] if the biggest guy in the command is greater than the biggest guy in the database stock
2. [3:43:34 PM] then it is impossible to cut
3. [3:43:49 PM] therefore we should go to the most appropriate default stock
4.
5. command = { 1, 1, 2, 3, 4, 5, 6, 7 }
6. remaning = { 1, 1, 2, 5 }
7.
8. 1) question is: do we run algorithm vs remaning stock first then we use default stock at the end? example
9.
10. start_point = reverse_loop(command)
11. {
12. if (start_point > remaning.last)
13. {
14. // use default stock
15. // [loop 1] = 7; (7 > 5)
16. // [loop 2] = 6; (6 > 5)
17. // [loop 4] = 4; (4 > 2)
18. // [loop 5] = 3; (3 > 2)
19. }
20. else
21. {
22. // use remaning stock
23. // [loop 3] = 5; (5 =< 5) // 5 removed from remaning now
24. // [loop 6] = 2; (2 =< 2) // 2 removed from remaning now
25. // [loop 7] = 1; (1 =< 1) // 1 removed from remaning now
26. // [loop 8] = 1; (1 =< 1) // 1 removed from remaning now
27. }
28. }
29.
30. command = { 3, 4, 6, 7 }
31. remaning = {};
32.
33. and now we can run command using default stock because we tested all our remaning stock first.
34. ## END OF QUESTION 1
35.
36. 2) if answer on first question is false, do we find a pattern for [loop 1] from default stock then, and then we continue searching for next and checking if we can use remaning stock? example:
37.
38. default_stock = 12;
39. remaning = { 1, 1, 2, 5 }
40.
41. command = { 1, 1, 2, 3, 4, 5, 6, 7 }
42. start_point = 7;
43. pattern found = 7 + 5;
44.
45. command = { 1, 1, 2, 3, 4, 6}
46. start_point = 6;
47. pattern_found = 6 + 4 + 2;
48.
49. command = { 1, 1, 3 }
50. start_point = 3;
51. we can now use remaning because 3 <= 5
52. pattern_found = 3 + 1 + 1;
53.
54. at the end we solve our problem and we still have remaning = { 1, 1, 2}
55. ## END OF QUESTION 2
RAW Paste Data

# Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×