#include <stdio.h> typedef struct { unsigned short Enable : 1; unsigned short Mode : 1; unsigned short Priority : 2; unsigned short Reserved : 12; } ConfigRegister; int validate_config(ConfigRegister *cfg) { return (((cfg->Reserved & 0xFFF) == 0) && (cfg->Enable) && (cfg->Priority != 0x03)); } int main() { ConfigRegister cfg; scanf("%hx", &cfg); int result = validate_config(&cfg); printf("%d", result); return 0; }
Test Cases
Test Results
Input
0005
Expected Output
1