-
Notifications
You must be signed in to change notification settings - Fork 1
/
Mosaic Decoration I
68 lines (58 loc) · 1.5 KB
/
Mosaic Decoration I
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//Following code is written in C language
/*PROBLEM STATEMENT
Zapray lives in a big mansion that has NN bathrooms. He wants to decorate the bathroom walls using mosaic tiles of two colors: black and pink. The iith bathroom needs B_iB
i
black tiles and P_iP
i
pink tiles. Mosaic tiles are sold in piles. Zapray can buy one pile of 1010 black tiles for C_BC
B
dollars, and one pile of 1010 pink tiles for C_PC
P
dollars. How much money does he need in total to decorate all the NN bathrooms?
Standard input
The input contains three integers N, C_B, C_PN,C
B
,C
P
on the first line.
The next NN lines each have two integers. The iith line has B_iB
i
and P_iP
i
.
Standard output
Output a single integer, the amount of money in dollars that Zapray needs to decorate all his bathrooms.
Constraints and notes
2 \leq N \leq 1002≤N≤100
1 \leq C_B, C_P \leq 1\,0001≤C
B
,C
P
≤1000
1 \leq B_i, P_i \leq 1\,0001≤B
i
,P
i
≤1000
*/
//CODE STARTS FROM HERE
#include <stdio.h>
void main()
{
int n, cb, cp, bi, pi, sbi = 0, spi = 0, cost = 0, sbir = 0, spir = 0;
scanf("%d%d%d", &n, &cb, &cp);
for (int i = 0; i < n; i++)
{
scanf("%d%d", &bi, &pi);
sbi += bi;
spi += pi;
}
spir = spi / 10;
sbir = sbi / 10;
if (sbir * 10 < sbi)
sbir++;
if (spir * 10 < spi)
spir++;
cost = ((sbir * cb) + (spir * cp));
printf("%d", cost);
}