#include <stdio.h>
#include <stdint.h>
uint8_t is_circular_match(uint16_t reg, uint16_t target) {
for(int i = 1; i <= 16; i++){
uint16_t test = 0;
uint8_t ans = 0;
test = (reg << i) | (reg >> (sizeof(reg) * 8 - i));
ans = (test == target)? 1 : 0;
if(ans == 1){
return ans;
}
}
return 0;
}
int main() {
uint16_t reg, target;
scanf("%hu %hu", ®, &target);
printf("%hhu", is_circular_match(reg, target));
return 0;
}
Input
45056 11
Expected Output
1