Cody

# Problem 2869. There are 10 types of people in the world

Solution 2012251

Submitted on 10 Nov 2019 by Doan Quang Manh
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
x = 1881;y_correct = 30; assert(isequal(yearraey(x),y_correct))

a = '11101011001' b = '10011010111' c = 1882 k = 2 c = 1883 k = 3 c = 1884 k = 4 c = 1885 k = 5 c = 1886 k = 6 c = 1887 k = 7 c = 1888 k = 8 c = 1889 k = 9 c = 1890 k = 10 c = 1891 k = 11 c = 1892 k = 12 c = 1893 k = 13 c = 1894 k = 14 c = 1895 k = 15 c = 1896 k = 16 c = 1897 k = 17 c = 1898 k = 18 c = 1899 k = 19 c = 1900 k = 20 c = 1901 k = 21 c = 1902 k = 22 c = 1903 k = 23 c = 1904 k = 24 c = 1905 k = 25 c = 1906 k = 26 c = 1907 k = 27 c = 1908 k = 28 c = 1909 k = 29 c = 1910 k = 30 c = 1911 k = 31 y = 30

2   Pass
x = 2014;y_correct = 1; assert(isequal(yearraey(x),y_correct))

a = '11111011110' b = '01111011111' c = 2015 k = 2 y = 1

3   Pass
x = 2015;y_correct = 0; assert(isequal(yearraey(x),y_correct))

a = '11111011111' b = '11111011111' y = 0

4   Pass
x = 606;y_correct = 27; assert(isequal(yearraey(x),y_correct))

a = '1001011110' b = '0111101001' c = 607 k = 2 c = 608 k = 3 c = 609 k = 4 c = 610 k = 5 c = 611 k = 6 c = 612 k = 7 c = 613 k = 8 c = 614 k = 9 c = 615 k = 10 c = 616 k = 11 c = 617 k = 12 c = 618 k = 13 c = 619 k = 14 c = 620 k = 15 c = 621 k = 16 c = 622 k = 17 c = 623 k = 18 c = 624 k = 19 c = 625 k = 20 c = 626 k = 21 c = 627 k = 22 c = 628 k = 23 c = 629 k = 24 c = 630 k = 25 c = 631 k = 26 c = 632 k = 27 c = 633 k = 28 y = 27

5   Pass
x = 6006;y_correct = 71; assert(isequal(yearraey(x),y_correct))

a = '1011101110110' b = '0110111011101' c = 6007 k = 2 c = 6008 k = 3 c = 6009 k = 4 c = 6010 k = 5 c = 6011 k = 6 c = 6012 k = 7 c = 6013 k = 8 c = 6014 k = 9 c = 6015 k = 10 c = 6016 k = 11 c = 6017 k = 12 c = 6018 k = 13 c = 6019 k = 14 c = 6020 k = 15 c = 6021 k = 16 c = 6022 k = 17 c = 6023 k = 18 c = 6024 k = 19 c = 6025 k = 20 c = 6026 k = 21 c = 6027 k = 22 c = 6028 k = 23 c = 6029 k = 24 c = 6030 k = 25 c = 6031 k = 26 c = 6032 k = 27 c = 6033 k = 28 c = 6034 k = 29 c = 6035 k = 30 c = 6036 k = 31 c = 6037 k = 32 c = 6038 k = 33 c = 6039 k = 34 c = 6040 k = 35 c = 6041 k = 36 c = 6042 k = 37 c = 6043 k = 38 c = 6044 k = 39 c = 6045 k = 40 c = 6046 k = 41 c = 6047 k = 42 c = 6048 k = 43 c = 6049 k = 44 c = 6050 k = 45 c = 6051 k = 46 c = 6052 k = 47 c = 6053 k = 48 c = 6054 k = 49 c = 6055 k = 50 c = 6056 k = 51 c = 6057 k = 52 c = 6058 k = 53 c = 6059 k = 54 c = 6060 k = 55 c = 6061 k = 56 c = 6062 k = 57 c = 6063 k = 58 c = 6064 k = 59 c = 6065 k = 60 c = 6066 k = 61 c = 6067 k = 62 c = 6068 k = 63 c = 6069 k = 64 c = 6070 k = 65 c = 6071 k = 66 c = 6072 k = 67 c = 6073 k = 68 c = 6074 k = 69 c = 6075 k = 70 c = 6076 k = 71 c = 6077 k = 72 y = 71

6   Pass
x = 60006;y_correct = 369; assert(isequal(yearraey(x),y_correct))

a = '1110101001100110' b = '0110011001010111' c = 60007 k = 2 c = 60008 k = 3 c = 60009 k = 4 c = 60010 k = 5 c = 60011 k = 6 c = 60012 k = 7 c = 60013 k = 8 c = 60014 k = 9 c = 60015 k = 10 c = 60016 k = 11 c = 60017 k = 12 c = 60018 k = 13 c = 60019 k = 14 c = 60020 k = 15 c = 60021 k = 16 c = 60022 k = 17 c = 60023 k = 18 c = 60024 k = 19 c = 60025 k = 20 c = 60026 k = 21 c = 60027 k = 22 c = 60028 k = 23 c = 60029 k = 24 c = 60030 k = 25 c = 60031 k = 26 c = 60032 k = 27 c = 60033 k = 28 c = 60034 k = 29 c = 60035 k = 30 c = 60036 k = 31 c = 60037 k = 32 c = 60038 k = 33 c = 60039 k = 34 c = 60040 k = 35 c = 60041 k = 36 c = 60042 k = 37 c = 60043 k = 38 c = 60044 k = 39 c = 60045 k = 40 c = 60046 k = 41 c = 60047 k = 42 c = 60048 k = 43 c = 60049 k = 44 c = 60050 k = 45 c = 60051 k = 46 c = 60052 k = 47 c = 60053 k = 48 c = 60054 k = 49 c = 60055 k = 50 c = 60056 k = 51 c = 60057 k = 52 c = 60058 k = 53 c = 60059 k = 54 c = 60060 k = 55 c = 60061 k = 56 c = 60062 k = 57 c = 60063 k = 58 c = 60064 k = 59 c = 60065 k = 60 c = 60066 k = 61 c = 60067 k = 62 c = 60068 k = 63 c = 60069 k = 64 c = 60070 k = 65 c = 60071 k = 66 c = 60072 k = 67 c = 60073 k = 68 c = 60074 k = 69 c = 60075 k = 70 c = 60076 k = 71 c = 60077 k = 72 c = 60078 k = 73 c = 60079 k = 74 c = 60080 k = 75 c = 60081 k = 76 c = 60082 k = 77 c = 60083 k = 78 c = 60084 k = 79 c = 60085 k = 80 c = 60086 k = 81 c = 60087 k = 82 c = 60088 k = 83 c = 60089 k = 84 c = 60090 k = 85 c = 60091 k = 86 c = 60092 k = 87 c = 60093 k = 88 c = 60094 k = 89 c = 60095 k = 90 c = 60096 k = 91 c = 60097 k = 92 c = 60098 k = 93 c = 60099 k = 94 c = 60100 k = 95 c = 60101 k = 96 c = 60102 k = 97 c = 60103 k = 98 c = 60104 k = 99 c = 60105 k = 100 c = 60106 k = 101 c = 60107 k = 102 c = 60108 k = 103 c = 60109 k = 104 c = 60110 k = 105 c = 60111 k = 106 c = 60112 k = 107 c = 60113 k = 108 c = 60114 k = 109 c = 60115 k = 110 c = 60116 k = 111 c = 60117 k = 112 c = 60118 k = 113 c = 60119 k = 114 c = 60120 k = 115 c = 60121 k = 116 c = 60122 k = 117 c = 60123 k = 118 c = 60124 k = 119 c = 60125 k = 120 c = 60126 k = 121 c = 60127 k = 122 c = 60128 k = 123 c = 60129 k = 124 c = 60130 k = 125 c = 60131 k = 126 c = 60132 k = 127 c = 60133 k = 128 c = 60134 k = 129 c = 60135 k = 130 c = 60136 k = 131 c = 60137 k = 132 c = 60138 k = 133 c = 60139 k = 134 c = 60140 k = 135 c = 60141 k = 136 c = 60142 k = 137 c = 60143 k = 138 c = 60144 k = 139 c = 60145 k = 140 c = 60146 k = 141 c = 60147 k = 142 c = 60148 k = 143 c = 60149 k = 144 c = 60150 k = 145 c = 60151 k = 146 c = 60152 k = 147 c = 60153 k = 148 c = 60154 k = 149 c = 60155 k = 150 c = 60156 k = 151 c = 60157 k = 152 c = 60158 k = 153 c = 60159 k = 154 c = 60160 k = 155 c = 60161 k = 156 c = 60162 k = 157 c = 60163 k = 158 c = 60164 k = 159 c = 60165 k = 160 c = 60166 k = 161 c = 60167 k = 162 c = 60168 k = 163 c = 60169 k = 164 c = 60170 k = 165 c = 60171 k = 166 c = 60172 k = 167 c = 60173 k = 168 c = 60174 k = 169 c = 60175 k = 170 c = 60176 k = 171 c = 60177 k = 172 c = 60178 k = 173 c = 60179 k = 174 c = 60180 k = 175 c = 60181 k = 176 c = 60182 k = 177 c = 60183 k = 178 c = 60184 k = 179 c = 60185 k = 180 c = 60186 k = 181 c = 60187 k = 182 c = 60188 k = 183 c = 60189 k = 184 c = 60190 k = 185 c = 60191 k = 186 c = 60192 k = 187 c = 60193 k = 188 c = 60194 k = 189 c = 60195 k = 190 c = 60196 k = 191 c = 60197 k = 192 c = 60198 k = 193 c = 60199 k = 194 c = 60200 k = 195 c = 60201 k = 196 c = 60202 k = 197 c = 60203 k = 198 c = 60204 k = 199 c = 60205 k = 200 c = 60206 k = 201 c = 60207 k = 202 c = 60208 k = 203 c = 60209 k = 204 c = 60210 k = 205 c = 60211 k = 206 c = 60212 k = 207 c = 60213 k = 208 c = 60214 k = 209 c = 60215 k = 210 c = 60216 k = 211 c = 60217 k = 212 c = 60218 k = 213 c = 60219 k = 214 c = 60220 k = 215 c = 60221 k = 216 c = 60222 k = 217 c = 60223 k = 218 c = 60224 k = 219 c = 60225 k = 220 c = 60226 k = 221 c = 60227 k = 222 c = 60228 k = 223 c = 60229 k = 224 c = 60230 k = 225 c = 60231 k = 226 c = 60232 k = 227 c = 60233 k = 228 c = 60234 k = 229 c = 60235 k = 230 c = 60236 k = 231 c = 60237 k = 232 c = 60238 k = 233 c = 60239 k = 234 c = 60240 k = 235 c = 60241 k = 236 c = 60242 k = 237 c = 60243 k = 238 c = 60244 k = 239 c = 60245 k = 240 c = 60246 k = 241 c = 60247 k = 242 c = 60248 k = 243 c = 60249 k = 244 c = 60250 k = 245 c = 60251 k = 246 c = 60252 k = 247 c = 60253 k = 248 c = 60254 k = 249 c = 60255 k = 250 c = 60256 k = 251 c = 60257 k = 252 c = 60258 k = 253 c = 60259 k = 254 c = 60260 k = 255 c = 60261 k = 256 c = 60262 k = 257 c = 60263 k = 258 c = 60264 k = 259 c = 60265 k = 260 c = 60266 k = 261 c = 60267 k = 262 c = 60268 k = 263 c = 60269 k = 264 c = 60270 k = 265 c = 60271 k = 266 c = 60272 k = 267 c = 60273 k = 268 c = 60274 k = 269 c = 60275 k = 270 c = 60276 k = 271 c = 60277 k = 272 c = 60278 k = 273 c = 60279 k = 274 c = 60280 k = 275 c = 60281 k = 276 c = 60282 k = 277 c = 60283 k = 278 c = 60284 k = 279 c = 60285 k = 280 c = 60286 k = 281 c = 60287 k = 282 c = 60288 k = 283 c = 60289 k = 284 c = 60290 k = 285 c = 60291 k = 286 c = 60292 k = 287 c = 60293 k = 288 c = 60294 k = 289 c = 60295 k = 290 c = 60296 k = 291 c = 60297 k = 292 c = 60298 k = 293 c = ...

7   Pass
k=zeros(1,15); for n=1:15 y=2^n+2; k(n)=yearraey(y); end y_correct=[1 1 5 3 11 7 23 15 47 31 95 63 191 127 383]; assert(isequal(k,y_correct))

a = '100' b = '001' c = 5 k = 2 y = 1 a = '110' b = '011' c = 7 k = 2 y = 1 a = '1010' b = '0101' c = 11 k = 2 c = 12 k = 3 c = 13 k = 4 c = 14 k = 5 c = 15 k = 6 y = 5 a = '10010' b = '01001' c = 19 k = 2 c = 20 k = 3 c = 21 k = 4 y = 3 a = '100010' b = '010001' c = 35 k = 2 c = 36 k = 3 c = 37 k = 4 c = 38 k = 5 c = 39 k = 6 c = 40 k = 7 c = 41 k = 8 c = 42 k = 9 c = 43 k = 10 c = 44 k = 11 c = 45 k = 12 y = 11 a = '1000010' b = '0100001' c = 67 k = 2 c = 68 k = 3 c = 69 k = 4 c = 70 k = 5 c = 71 k = 6 c = 72 k = 7 c = 73 k = 8 y = 7 a = '10000010' b = '01000001' c = 131 k = 2 c = 132 k = 3 c = 133 k = 4 c = 134 k = 5 c = 135 k = 6 c = 136 k = 7 c = 137 k = 8 c = 138 k = 9 c = 139 k = 10 c = 140 k = 11 c = 141 k = 12 c = 142 k = 13 c = 143 k = 14 c = 144 k = 15 c = 145 k = 16 c = 146 k = 17 c = 147 k = 18 c = 148 k = 19 c = 149 k = 20 c = 150 k = 21 c = 151 k = 22 c = 152 k = 23 c = 153 k = 24 y = 23 a = '100000010' b = '010000001' c = 259 k = 2 c = 260 k = 3 c = 261 k = 4 c = 262 k = 5 c = 263 k = 6 c = 264 k = 7 c = 265 k = 8 c = 266 k = 9 c = 267 k = 10 c = 268 k = 11 c = 269 k = 12 c = 270 k = 13 c = 271 k = 14 c = 272 k = 15 c = 273 k = 16 y = 15 a = '1000000010' b = '0100000001' c = 515 k = 2 c = 516 k = 3 c = 517 k = 4 c = 518 k = 5 c = 519 k = 6 c = 520 k = 7 c = 521 k = 8 c = 522 k = 9 c = 523 k = 10 c = 524 k = 11 c = 525 k = 12 c = 526 k = 13 c = 527 k = 14 c = 528 k = 15 c = 529 k = 16 c = 530 k = 17 c = 531 k = 18 c = 532 k = 19 c = 533 k = 20 c = 534 k = 21 c = 535 k = 22 c = 536 k = 23 c = 537 k = 24 c = 538 k = 25 c = 539 k = 26 c = 540 k = 27 c = 541 k = 28 c = 542 k = 29 c = 543 k = 30 c = 544 k = 31 c = 545 k = 32 c = 546 k = 33 c = 547 k = 34 c = 548 k = 35 c = 549 k = 36 c = 550 k = 37 c = 551 k = 38 c = 552 k = 39 c = 553 k = 40 c = 554 k = 41 c = 555 k = 42 c = 556 k = 43 c = 557 k = 44 c = 558 k = 45 c = 559 k = 46 c = 560 k = 47 c = 561 k = 48 y = 47 a = '10000000010' b = '01000000001' c = 1027 k = 2 c = 1028 k = 3 c = 1029 k = 4 c = 1030 k = 5 c = 1031 k = 6 c = 1032 k = 7 c = 1033 k = 8 c = 1034 k = 9 c = 1035 k = 10 c = 1036 k = 11 c = 1037 k = 12 c = 1038 k = 13 c = 1039 k = 14 c = 1040 k = 15 c = 1041 k = 16 c = 1042 k = 17 c = 1043 k = 18 c = 1044 k = 19 c = 1045 k = 20 c = 1046 k = 21 c = 1047 k = 22 c = 1048 k = 23 c = 1049 k = 24 c = 1050 k = 25 c = 1051 k = 26 c = 1052 k = 27 c = 1053 k = 28 c = 1054 k = 29 c = 1055 k = 30 c = 1056 k = 31 c = 1057 k = 32 y = 31 a = '100000000010' b = '010000000001' c = 2051 k = 2 c = 2052 k = 3 c = 2053 k = 4 c = 2054 k = 5 c = 2055 k = 6 c = 2056 k = 7 c = 2057 k = 8 c = 2058 k = 9 c = 2059 k = 10 c = 2060 k = 11 c = 2061 k = 12 c = 2062 k = 13 c = 2063 k = 14 c = 2064 k = 15 c = 2065 k = 16 c = 2066 k = 17 c = 2067 k = 18 c = 2068 k = 19 c = 2069 k = 20 c = 2070 k = 21 c = 2071 k = 22 c = 2072 k = 23 c = 2073 k = 24 c = 2074 k = 25 c = 2075 k = 26 c = 2076 k = 27 c = 2077 k = 28 c = 2078 k = 29 c = 2079 k = 30 c = 2080 k = 31 c = 2081 k = 32 c = 2082 k = 33 c = 2083 k = 34 c = 2084 k = 35 c = 2085 k = 36 c = 2086 k = 37 c = 2087 k = 38 c = 2088 k = 39 c = 2089 k = 40 c = 2090 k = 41 c = 2091 k = 42 c = 2092 k = 43 c = 2093 k = 44 c = 2094 k = 45 c = 2095 k = 46 c = 2096 k = 47 c = 2097 k = 48 c = 2098 k = 49 c = 2099 k = 50 c = 2100 k = 51 c = 2101 k = 52 c = 2102 k = 53 c = 2103 k = 54 c = 2104 k = 55 c = 2105 k = 56 c = 2106 k = 57 c = 2107 k = 58 c = 2108 k = 59 c = 2109 k = 60 c = 2110 k = 61 c = 2111 k = 62 c = 2112 k = 63 c = 2113 k = 64 c = 2114 k = 65 c = 2115 k = 66 c = 2116 k = 67 c = 2117 k = 68 c = 2118 k = 69 c = 2119 k = 70 c = 2120 k = 71 c = 2121 k = 72 c = 2122 k = 73 c = 2123 k = 74 c = 2124 k = 75 c = 2125 k = 76 c = 2126 k = 77 c = 2127 k = 78 c = 2128 k = 79 c = 2129 k = 80 c = 2130 k = 81 c = 2131 k = 82 c = 2132 k = 83 c = 2133 k = 84 c = 2134 k = 85 c = 2135 k = 86 c = 2136 k = 87 c = 2137 k = 88 c = 2138 k = 89 c = 2139 k = 90 c = 2140 k = 91 c = 2141 k = 92 c = 2142 k = 93 c = 2143 k = 94 c = 2144 k = 95 c = 2145 k = 96 y = 95 a = '1000000000010' b = '0100000000001' c = 4099 k = 2 c = 4100 k = 3 c = 4101 k = 4 c = 4102 k = 5 c = 4103 k = 6 c = 4104 k = 7 c = 4105 k = 8 c = 4106 k = 9 c = 4107 k = 10 c = 4108 k = 11 c = 4109 k = 12 c = 4110 k = 13 c = 4111 k = 14 c = 4112 k = 15 c = 4113 k = 16 c = 4114 k = 17 c = 4115 k = 18 c = 4116 k = 19 c = 4117 k = 20 c = 4118 k = 21 c = 4119 k = 22 c = 4120 k = 23 c = 4121 k = 24 c = 4122 k = 25 c = 4123 k = 26 c = 4124 k = 27 c = 4125 k = 28 c = 4126 k = 29 c = 4127 k = 30 c = 4128 k = 31 c = 4129 k = 32 c = 4130 k = 33 c = 4131 k = 34 c = 4132 k = 35 c = 4133 k = 36 c = 4134 k = 37 c = 4135 k = 38 c = 4136 k = 39 c = 4137 k = 40 c = 4138 k = 41 c = 4139 k = 42 c = 4140 k = 43 c = 4141 k = 44 c = 4142 k = 45 c = 4143 k = 46 c = 4144 k = 47 c = 4145 k = 48 c = 4146 k = 49 c = 4147 k = 50 c = 4148 k = 51 c = 4149 k = 52 c = 4150 k = 53 c = 4151 k = 54 c = 4152 k = 55 c = 4153 k = 56 c = ...