You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
394 B
C
28 lines
394 B
C
3 years ago
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
int main() {
|
||
|
unsigned N, i, page_n, log;
|
||
|
|
||
|
scanf("%u", &N);
|
||
|
unsigned *mem = (unsigned*)calloc(N, sizeof(unsigned));
|
||
|
for (i = 0; i < N; ++i) {
|
||
|
scanf("%x", &mem[i]);
|
||
|
}
|
||
|
|
||
|
scanf("%x", &log);
|
||
|
page_n = (log >> 26) & 0b111111;
|
||
|
if (page_n < N) {
|
||
|
printf("%x", mem[page_n]+(log << 6 >> 6));
|
||
|
}
|
||
|
else {
|
||
|
printf("error");
|
||
|
}
|
||
|
|
||
|
|
||
|
free(mem);
|
||
|
return 0;
|
||
|
|
||
|
|
||
|
}
|