#include <iostream> using namespace std; int circularMatch(unsigned int reg, unsigned int target) { reg &= 0xFFFF; target &= 0xFFFF; for (int i = 0; i < 16; i++) { unsigned int rotated = ((reg << i) | (reg >> (16 - i))) & 0xFFFF; if (rotated == target) return 1; } return 0; } int main() { unsigned int reg, target; cin >> reg >> target; cout << circularMatch(reg, target); return 0; }
Test Cases
Test Results
Input
45056 11
Expected Output
1