#include <stdio.h> #include <stdint.h> static uint16_t rol16(uint16_t x, uint16_t n) { // Your code here n%=16; return (uint16_t)(x<<n)|(x>>(16-n)) ; } int detect_circular_pattern_match(uint16_t reg,uint16_t target){ for(uint16_t i=0;i<16;i++){ if (rol16(reg,i)==target){ return 1; } } return 0; } int main() { uint16_t reg, target; scanf("%hu %hu", ®, &target); printf("%hhu", detect_circular_pattern_match(reg, target)); return 0; }
Test Cases
Test Results
Input
45056 11
Expected Output
1