Cody

# Problem 2799. Multiply Column

Solution 550090

Submitted on 26 Dec 2014 by Abdullah Caliskan
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
%% M=[1 2 2 5 2 5 2 3 4 6 4 6 3 4 6 1 5 7]; n=2; Result=[2 10 10 6 24 24 12 6 35 ]; assert(isequal(Multiply_Column(M,n),Result))

M(:,:,1) = 1 2 2 3 3 4 M(:,:,2) = 2 5 4 6 6 1 M(:,:,3) = 2 5 4 6 5 7

2   Pass
%% M=[1 2 2 5 2 5 2 3 4 6 4 6 3 4 6 1 5 7]; n=3; Result= [ 4 50 24 144 72 35]; assert(isequal(Multiply_Column(M,n),Result))

M(:,:,1) = 1 2 2 2 3 4 3 4 6 M(:,:,2) = 5 2 5 6 4 6 1 5 7

3   Pass
%% M=magic(16) n=4 Result=[388608 2635416 6683600 12348840 19339880 27714960 37191000 47608256 58813128 70658160 83002040 95709600 108732000 121781880 134826800 147756168 160465536 172856600 184837200 196321320 207181800 217443600 226987736 235752768 243683400 250730480 256851000 262008096 266185440 269325560 271428528 272482056 272480000 271422360 269315280 266171048 262026600 256873616 250757208 243714240 235787720 227026800 217486776 207229088 196269920 184781688 172796976 160401800 147688320 134754840 121705808 108651816 95793896 83090448 70750680 58909760 47709000 37295856 27823928 19452960 12231648 6562296 2510000 259080] assert(isequal(Multiply_Column(M,n),Result))

M = 256 2 3 253 252 6 7 249 248 10 11 245 244 14 15 241 17 239 238 20 21 235 234 24 25 231 230 28 29 227 226 32 33 223 222 36 37 219 218 40 41 215 214 44 45 211 210 48 208 50 51 205 204 54 55 201 200 58 59 197 196 62 63 193 192 66 67 189 188 70 71 185 184 74 75 181 180 78 79 177 81 175 174 84 85 171 170 88 89 167 166 92 93 163 162 96 97 159 158 100 101 155 154 104 105 151 150 108 109 147 146 112 144 114 115 141 140 118 119 137 136 122 123 133 132 126 127 129 128 130 131 125 124 134 135 121 120 138 139 117 116 142 143 113 145 111 110 148 149 107 106 152 153 103 102 156 157 99 98 160 161 95 94 164 165 91 90 168 169 87 86 172 173 83 82 176 80 178 179 77 76 182 183 73 72 186 187 69 68 190 191 65 64 194 195 61 60 198 199 57 56 202 203 53 52 206 207 49 209 47 46 212 213 43 42 216 217 39 38 220 221 35 34 224 225 31 30 228 229 27 26 232 233 23 22 236 237 19 18 240 16 242 243 13 12 246 247 9 8 250 251 5 4 254 255 1 n = 4 Result = 388608 2635416 6683600 12348840 19339880 27714960 37191000 47608256 58813128 70658160 83002040 95709600 108732000 121781880 134826800 147756168 160465536 172856600 184837200 196321320 207181800 217443600 226987736 235752768 243683400 250730480 256851000 262008096 266185440 269325560 271428528 272482056 272480000 271422360 269315280 266171048 262026600 256873616 250757208 243714240 235787720 227026800 217486776 207229088 196269920 184781688 172796976 160401800 147688320 134754840 121705808 108651816 95793896 83090448 70750680 58909760 47709000 37295856 27823928 19452960 12231648 6562296 2510000 259080 M(:,:,1) = 256 2 3 253 17 239 238 20 33 223 222 36 208 50 51 205 192 66 67 189 81 175 174 84 97 159 158 100 144 114 115 141 128 130 131 125 145 111 110 148 161 95 94 164 80 178 179 77 64 194 195 61 209 47 46 212 225 31 30 228 16 242 243 13 M(:,:,2) = 252 6 7 249 21 235 234 24 37 219 218 40 204 54 55 201 188 70 71 185 85 171 170 88 101 155 154 104 140 118 119 137 124 134 135 121 149 107 106 152 165 91 90 168 76 182 183 73 60 198 199 57 213 43 42 216 229 27 26 232 12 246 247 9 M(:,:,3) = 248 10 11 245 25 231 230 28 41 215 214 44 200 58 59 197 184 74 75 181 89 167 166 92 105 151 150 108 136 122 123 133 120 138 139 117 153 103 102 156 169 87 86 172 72 186 187 69 56 202 203 53 217 39 38 220 233 23 22 236 8 250 251 5 M(:,:,4) = 244 14 15 241 29 227 226 32 45 211 210 48 196 62 63 193 180 78 79 177 93 163 162 96 109 147 146 112 132 126 127 129 116 142 143 113 157 99 98 160 173 83 82 176 68 190 191 65 52 206 207 49 221 35 34 224 237 19 18 240 4 254 255 1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