Created
May 16, 2014 14:04
-
-
Save undergroundmonorail/7e7a6a9033725b0cb346 to your computer and use it in GitHub Desktop.
My (non-spoilery) solution for Project Euler problem 32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python2 | |
def decrypt(message, key): | |
o = [] | |
for c in map(int, message.split()): | |
o.append(c^key % 10) | |
key = str(key) | |
key = int(key[1:] + key[0]) | |
return o | |
s = '43 37 42 96 107 102 43 117 123 118 96 107 107 48 8 2 98 119 109 111 40 109 113 103 112 124 107 106 110 113 40 109 104 114 109 122 112 37 114 103 122 105 112 118 99 124 109 106 108 113 2 14 99 109 119 102 96 37 63 34 123 97 113 42 43 40 39 37 75 108 123 112 96 99 102 40 107 99 34 99 108 96 108 108 101 40 97 100 97 106 40 105 100 118 97 96 36 113 109 34 105 36 118 107 108 111 104 96 34 116 105 118 108 99 96 100 97 41 34 117 109 36 100 102 102 40 112 109 103 111 2 36 37 34 34 40 36 37 34 34 40 36 37 34 34 43 36 113 109 34 105 36 118 103 118 40 101 107 102 34 123 113 104 34 107 124 36 105 99 118 109 118 15 8 33 40 66 106 112 34 109 101 102 106 34 123 112 119 107 108 111 36 119 103 114 122 97 118 103 108 124 109 107 101 34 105 36 117 103 112 101 113 113 99 118 97 107 107 34 109 110 36 34 51 48 59 48 48 52 53 48 61 34 8 100 103 118 37 114 34 97 106 37 111 99 120 44 105 99 111 106 96 100 34 114 50 36 39 32 44 98 107 108 108 42 120 45 41 34 114 109 118 104 119 118 105 112 108 109 108 123 44 34 51 48 59 48 48 52 53 48 61 34 43 43 50 14 12 100 109 122 36 108 34 107 102 36 125 112 99 102 99 96 42 51 36 60 44 56 8 1 13 38 34 42 64 101 107 101 34 103 106 41 34 75 40 112 109 107 108 99 36 113 106 107 123 36 108 113 34 105 36 103 119 101 38 36 86 106 109 125 104 97 108 37 124 36 108 118 34 98 113 118 118 34 106 97 37 122 112 105 106 98 103 42 97 47 52 46 34 57 52 44 61 8 1 13 38 34 44 38 42 15 11 11 43 36 43 44 44 2 13 12 33 34 38 42 43 100 119 107 111 37 107 118 36 36 108 118 34 127 107 119 105 113 38 45 15 11 11 110 107 119 34 104 40 109 107 34 122 122 101 107 101 103 32 109 46 51 46 40 53 53 47 107 33 62 15 11 11 1 39 37 75 108 123 97 119 118 34 105 36 34 40 37 40 101 113 34 118 96 97 37 107 118 96 36 108 108 102 109 124 37 99 108 108 36 100 34 37 53 57 34 34 42 124 108 100 118 37 123 36 113 117 109 40 97 116 119 99 100 119 37 113 107 111 106 118 46 34 110 107 119 8 11 1 13 38 34 118 96 107 118 103 34 103 98 37 123 109 125 36 117 110 99 113 109 107 101 34 105 112 37 106 109 101 97 44 34 99 124 36 113 106 103 40 110 113 106 34 97 106 97 103 122 38 14 12 11 11 123 36 56 34 114 83 62 108 95 34 35 36 34 40 37 40 47 37 114 89 97 62 111 95 34 35 36 34 63 63 47 36 46 34 114 83 110 63 95 8 1 13 12 114 112 97 106 113 34 113 40 39 37 81 110 103 115 118 34 118 96 97 37 114 112 103 99 119 99 111 40 96 106 117 108 36 36 103 119 118 40 104 106 109 105 123 36 107 107 97 109 42 37 67 110 123 107 37 108 107 107 97 37 118 109 40 102 96 34 99 106 104 96 34 118 103 14 12 11 11 40 36 37 34 34 40 36 37 33 34 123 97 96 34 106 103 115 37 97 110 103 119 96 34 118 103 36 113 106 103 40 97 107 102 34 127 97 37 99 112 109 42 37 86 106 97 119 37 114 112 103 99 119 99 111 40 112 100 105 103 123 36 100 34 117 96 109 105 103 44 2 13 12 11 33 40 86 96 97 99 120 62 37 67 118 40 112 109 107 113 40 116 106 107 108 124 40 37 118 106 109 36 115 99 112 97 101 103 110 103 40 119 37 97 109 102 112 100 107 108 123 36 100 34 113 124 118 108 108 101 40 104 108 105 103 40 112 109 107 113 50 14 12 11 11 43 36 39 51 48 59 46 49 55 52 53 57 50 58 59 42 14 12 11 11 43 36 81 106 107 123 36 108 113 34 105 36 115 99 110 97 96 37 114 123 124 108 106 108 34 123 112 100 118 111 109 106 113 44 8 1 13 12 107 100 40 97 115 99 110 32 119 44 56 34 43 36 76 100 34 97 112 34 113 34 92 118 112 103 46 40 112 109 112 109 127 36 108 118 34 97 106 37 68 109 125 106 97 44 8 1 13 12 11 100 103 113 107 102 44 105 96 97 42 107 102 112 45 114 89 98 62 88 43 43 2 14 117 112 107 102 112 37 113 119 101 44 99 109 119 102 96 44 34 33 40 87 112 111 34 97 112 37 99 108 108 36 117 112 107 102 112 36' | |
# Replace k with the answer to Project Euler problem 32. | |
k = 0 | |
# Replace print with exec to run | |
print ''.join(map(chr, decrypt(s, k))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment