-
Notifications
You must be signed in to change notification settings - Fork 0
/
tarefa2.c
38 lines (30 loc) · 674 Bytes
/
tarefa2.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <stdlib.h>
#include <stdio.h>
typedef char* Linha;
typedef Linha* Tab;
void ignorar_espacos() {
scanf("%*[ \n\t]");
}
int main() {
int sizeX, sizeY, i, j;
scanf("%d", &sizeX);
scanf("%d", &sizeY);
ignorar_espacos();
Tab tab = (Tab) malloc(sizeof(Linha) * sizeX);
for(i = 0; i < sizeX; ++i) {
tab[i] = (Linha) malloc(sizeof(char) * sizeY);
for(j = 0; j < sizeY; ++j) {
scanf("%c", &tab[i][j]);
ignorar_espacos();
}
}
int coord_count;
scanf("%d\n", &coord_count);
for(i = 0; i < coord_count; ++i) {
int x, y;
scanf("%d\n", &x);
scanf("%d\n", &y);
printf("%c", tab[x-1][y-1]);
}
printf("\n");
}