#include <stdio.h> #include <stdint.h> uint16_t spread_bits(uint8_t val) { uint16_t result = 0; for(int i=0; i<=7; i++){ uint8_t check = (val >> i) & 1; if(check == 1){ result |= (1 << (i*2)); } } return result; } int main() { uint8_t val; scanf("%hhu", &val); uint16_t result = spread_bits(val); printf("%u", result); return 0; }
Test Cases
Test Results
Input
202
Expected Output
20548