Cody

Problem 46963. Roots, Bloody Roots: part 2/2

Solution 3322928

Submitted on 22 Oct 2020 by Svyatoslav Golousov
  • Size: 381
  • This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
filetext = fileread('visComplexFunctions.m'); assert(~contains(filetext, 'eval'), 'eval is forbidden.'); assert(~contains(filetext, 'regexp'), 'regexp is forbidden.'); assert(~contains(filetext, 'str2num'), 'str2num is forbidden.'); assert(~contains(filetext, '!'), 'Shell commands are forbidden.'); assert(~contains(filetext, 'mlock'), 'mlock is forbidden.'); assert(~contains(filetext, 'munlock'), 'munlock is forbidden.'); assert(~contains(filetext, 'fopen'), 'fopen is forbidden.');

2   Pass
m = 500; n = 500; P = [1 0]; A = 1; g = 1/3; J = visComplexFunctions(m,n,P,A,g); y_correct = [67 151 134 57 63 114 55 70 233 171 65 27 23 111 73 86 141 198 167 176 195 23 84 33 131 21 126 79 252 17 42 206 197 31 22 228 169 155 152 215 201 192 74 163 49 115 189 162 31 61 189 176 211 9 200 45 178 212 151 46 45 52 150 119]; assert(all(uint8(py.hashlib.sha512(py.str(mat2str(J(:))).encode('utf-8')).digest()) == y_correct));

3   Pass
m = 288; n = 313; P = [1 -9 20]; A = 2; g = 1/4; J = visComplexFunctions(m,n,P,A,g); y_correct = [3 2 108 135 250 68 32 87 219 238 241 146 159 206 29 89 105 62 3 38 172 74 87 182 240 128 51 106 175 46 191 249 55 107 66 150 132 7 55 217 49 230 100 81 254 253 168 61 184 79 73 10 185 255 77 183 129 55 141 150 25 129 166 239]; assert(all(uint8(py.hashlib.sha512(py.str(mat2str(J(:))).encode('utf-8')).digest()) == y_correct));

4   Pass
m = 288; n = 313; P = [1 -10j -21]; A = 1; g = 1/5; J = visComplexFunctions(m,n,P,A,g); y_correct = [155 34 217 156 139 224 158 245 214 150 110 149 103 106 146 214 68 192 63 203 244 145 24 159 132 106 167 74 108 220 189 69 167 243 205 168 124 65 224 166 110 190 235 137 190 126 26 154 137 95 8 107 22 206 231 21 68 20 62 190 101 169 210 213]; assert(all(uint8(py.hashlib.sha512(py.str(mat2str(J(:))).encode('utf-8')).digest()) == y_correct));

5   Pass
m = 501; n = 520; P = [1 0 0 8]; A = 1.5; g = 1/10; J = visComplexFunctions(m,n,P,A,g); y_correct = [141 102 223 146 20 110 62 97 40 118 21 154 195 204 17 85 153 239 59 60 187 153 114 248 98 54 81 46 164 187 217 229 160 66 138 55 134 248 132 200 101 175 5 113 23 179 22 133 234 106 81 71 121 156 11 197 55 172 13 60 92 190 227 222]; assert(all(uint8(py.hashlib.sha512(py.str(mat2str(J(:))).encode('utf-8')).digest()) == y_correct));

6   Pass
m = 333; n = 456; P = [2 3 7 5 4 9 6]; A = 1; g = 1/100; J = visComplexFunctions(m,n,P,A,g); y_correct = [33 121 184 78 3 160 247 95 87 56 130 105 13 207 68 54 95 82 167 247 130 84 208 214 32 51 71 216 122 33 66 98 225 133 161 229 40 120 156 108 66 65 168 201 216 212 210 35 209 179 13 44 163 54 27 15 193 241 139 165 135 35 133 116]; assert(all(uint8(py.hashlib.sha512(py.str(mat2str(J(:))).encode('utf-8')).digest()) == y_correct));

7   Pass
m = 400; n = 400; P = [1, zeros(1,9), -1]; A = 2; g = 1/10; J = visComplexFunctions(m,n,P,A,g); y_correct = [125 241 216 228 94 158 103 189 54 61 152 118 211 211 55 71 69 29 197 245 63 208 134 79 56 227 95 120 228 241 180 29 135 141 148 37 1 9 197 227 119 73 78 32 245 119 155 33 230 131 13 88 94 178 60 131 222 151 23 204 69 10 119 71]; assert(all(uint8(py.hashlib.sha512(py.str(mat2str(J(:))).encode('utf-8')).digest()) == y_correct));

8   Pass
m = 345; n = 345; P = [23.5333 71.8885 61.0979 15.3443 -63.4155 -52.0136 77.3024 -94.2652 -2.0197 -66.4146 95.7361 42.5389 0.0943 -5.7823 -88.0762 36.3944 -91.5138 -85.7109 4.33 -80.654 63.6297 63.5094 44.4879 -70.0269 31.9211 3.719 94.5949 29.7983 60.0661 -9.2405 -13.5217 65.0628 -83.306 -73.3658 -65.3223 -21.8124 66.2759 60.6729 -87.9058 -20.1484 5.3752 -16.6401 31.372 25.5947 -41.6032 -13.6698 -96.9026 96.8127 -66.5663 -78.7567 -25.5181]; A = 4.2; g = 1/70; J = visComplexFunctions(m,n,P,A,g); y_correct = [74 14 97 210 12 6 2 10 1 14 52 179 120 217 104 175 208 234 172 69 215 119 4 191 68 248 23 75 25 254 172 191 219 51 154 44 31 96 164 199 194 25 237 79 254 3 216 8 63 244 125 112 208 154 222 68 249 101 200 220 211 113 247 17]; assert(all(uint8(py.hashlib.sha512(py.str(mat2str(J(:))).encode('utf-8')).digest()) == y_correct));

Suggested Problems

More from this Author5

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!