Archived
1
0
Fork 0
This repository has been archived on 2022-06-20. You can view files and clone it, but cannot push or open issues or pull requests.
mipt_clang/cpu/simple_page.c

28 lines
394 B
C
Raw Normal View History

2022-03-14 22:08:02 +03:00
#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;
}