/home/toolbox/public_html/solutions/132/13287/b.c
1 #include <stdio.h>
2 #include <string.h>
3 #include <sys/types.h>
4 #include <sys/stat.h>
5 #include <fcntl.h>
6 #include <stdlib.h>
7 #include <math.h>
8 #include <stdint.h>
9
10 #define TRUE (1 == 1)
11 #define FALSE (1 != 1)
12
13 #define DEBUG if (FALSE)
14
15 /* fprintf(stderr, "functionName: message", varslist); */
16
17 /*
18 * Author: Isaac Traxler
19 * Date: 2018-10-23
20 * Purpose: fun
21 * Problem: 13287
22 */
23
24 /*
25 * This template reads data a specified number of times.
26 */
27
28 int numberOfTimes;
29 int width;
30 int lgth;
31 int tot;
32
33 void init()
34 {
35 /* FUNCTION init */
36 scanf("%d ", &numberOfTimes);
37 } /* FUNCTION init */
38
39 void dump()
40 {
41 /* FUNCTION dump */
42 } /* FUNCTION dump */
43
44 void getInput()
45 {
46 /* FUANCTION getInput */
47 int i;
48 int x;
49 int y;
50 int cnt;
51
52 tot = 0;
53 scanf(" %d ", &width);
54 scanf(" %d ", &cnt);
55 DEBUG printf("(width = %d) (cnt = %d) (tot = %d)\n", width, cnt, tot);
56 for (i=0; cnt>i; i++)
57 {
58 /* for */
59 scanf(" %d %d ", &x, &y);
60 tot = tot + (x * y);
61 } /* for */
62 DEBUG printf("(width = %d) (cnt = %d) (tot = %d)\n", width, cnt, tot);
63 } /* FUNCTION getInput */
64
65 void process()
66 {
67 /* FUNCTION process */
68 lgth = tot / width;
69 printf("%d\n", lgth);
70 } /* FUNCTION process */
71
72 int main()
73 {
74 /* main */
75 int i;
76
77 {
78 /* while */
79 getInput();
80 process();
81 } /* while */
82
83 return EXIT_SUCCESS;
84 } /* main */
85
86