Algorithm


Problem Name: beecrowd | 3174

Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/3174

Noel's Work Groups

 

By Jessica Dagostini, beecrowd BR Brazil

Timelimit: 1

Every year, Santa Claus recruits elves and gnomes for his Christmas preparation team. The sector of his production that changes the most during the year is the manufacture of gifts, as he hires temporary elves, who work H hours of the day with him. Also, each elf is hired for one of the 4 different working groups, where each group has some hours to produce gifts of the group type:

  • Dolls group (in Portuguese, bonecos): 8 hours;
  • Architects group (in Portuguese, arquitetos): 4 hours;
  • Musicians group (in Portuguese, musicos): 6 hours;
  • Drawners group (in Portuguese, desenhistas): 12 hours.

Note that the elves in the dolls group only produce dolls, architects, houses, and so on. But each type of gift counts as a complete gift at the end of the day.

Santa Claus has a list of the elves' names chosen this year, with the number of hours and in which group they can work. Knowing your programming skills, Noel wants a little help from you to tell him how many gifts he will be able to have ready, per day, according to the number of elves he has hired and the availability of them.

 

Input

 

The first input value is an integer N (1 ≤ N ≤ 1000), indicating the number of elves Santa has hired. The following N lines have three values E, G and H (1 ≤ H ≤ 24), indicating respectively the name of the elf, which group he/she will work in (in lower case) and how many hours a day he will help (in full value).

 

Output

 

The output should be an integer P , the total amount of gifts produced per day by Santa’s factory.

 

 

 

Input Sample Output Sample

7
Aradhel bonecos 10
Aerin arquitetos 15
Anna musicos 10
Elbereth musicos 10
Freda desenhistas 15
Arwen bonecos 10
Logolas bonecos 10

10

 

Code Examples

#1 Code Example with Python Programming

Code - Python Programming


b = 0
a = 0
m = 0
d = 0
for i in range(int(input())):
    e,g,h = input().split()
    h=int(h)
  
    if(g=='bonecos'):
        b = b + h
    elif(g=='arquitetos'):
        a = a + h
    elif(g=='musicos'):
        m = m + h
    elif(g=='desenhistas'):
        d = d + h
a = int(a/4)
b = int(b/8)
d = int(d/12)
m = int(m/6)
total = a+b+d+m

print(total)
Copy The Code & Try With Live Editor

Input

x
+
cmd
7 Aradhel bonecos 10 Aerin arquitetos 15 Anna musicos 10 Elbereth musicos 10 Freda desenhistas 15 Arwen bonecos 10 Logolas bonecos 10

Output

x
+
cmd
10
Advertisements

Demonstration


Previous
#3173 Beecrowd Online Judge Solution 3173 Christmas Star Solution in C, C++, Java, Js and Python
Next
#3209 Beecrowd Online Judge Solution 3209 Electrical Outlets Solution in C, C++, Java, Js and Python