-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEuler_Problem-062.b93
91 lines (77 loc) · 25.3 KB
/
Euler_Problem-062.b93
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
v $ #####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
$ #####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
$ #####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
$ #####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
$ #####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
v _v#!:p/g42\+ <
>5 28p 78*9*3-: 24p 68*: 25p*:26p >1-:0\:24g%4^
v < v+1 <
0 |-g02<
>1+:::**:22p 0\v v\-1 <>20p0>:3*:24g%4+\24 g/g:|
$ v+55:<>\1>9*\:|: @$$$.g/g42\+4%g42:+1$ <
>%\:#^|#/+55\$<+ > 3*:2+:24g%4+\24g/g1+:28g-!|
>$ #\>#<>\# :#+_^ >*::2v vp/g42\+4%g42:+2\<
^p/g42\+4%g42:+2\1p/g42\+4%g42:+1\g22p/g42\+4%g42:\g0 <
^ <
[2,0] current combinatoric-hash
[2,1] current index
[2,2] current cube
[2,4] ARR-WIDTH (const)
[2,5] ARR-HEIGHT (const)
[2,6] ARR-SIZE (const)
[2,8] PERMUTATION COUNT (const) = 5
arr-width = 501 => 78*9*3- --> [2,4]
arr-height = 48 => 68* --> [2,5]
arr-size = 24048 (8016 elements) = => " &"* --> [2,6]
arr[n*3+0] -> hash
arr[n*3+1] -> cube
arr[n*3+2] -> count
---------------------------------------
Only after at least sixty-two mathematical programs in befunge you will **truly** appreciate a hashtable.
For real, everything would be so much better if I could retrieve this stuff in `O(1)`.
My approach is pretty straight-forward. We calculate an permutation-insensitive hash.
Then store them together with the times it appeared in a hashmap *(I mean a list -.-)*.
Now we just go through all the cubes until a single hash appeared five times. In C# with a Dictionary this takes around 10ms.