-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibrary.c
41 lines (36 loc) · 1.04 KB
/
library.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
39
40
41
#include<stdio.h>
#include<string.h>
int main()
{
int total_number_of_books[100] = {0}; //total number of books in each selves
int total_number_of_shelves;
int total_number_of_pages[100][100] = {0}; // Number of pages in each selves on each book number
scanf("%d", &total_number_of_shelves);
int total_number_of_queries;
scanf("%d", &total_number_of_queries);
while (total_number_of_queries--)
{
int type_of_query;
scanf("%d", &type_of_query);
if (type_of_query == 1)
{
int x, y;
scanf("%d %d", &x, &y);
total_number_of_books[x] += 1;
total_number_of_pages[x][total_number_of_books[x]-1] = y;
}
else if (type_of_query == 2)
{
int x, y;
scanf("%d %d", &x, &y);
printf("%d\n", total_number_of_pages[x][y]);
}
else
{
int x;
scanf("%d", &x);
printf("%d\n",total_number_of_books[x]);
}
}
return 0;
}