Logo
(追記) (追記ここまで)

7602번 - Exercise 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB83727186.585%

문제

Our local gym has a number of exercise machines, each of which has a number of "levels". Some levels are harder than others, and exercising at those levels uses more energy per minute than at the easier levels. In this problem you have to work out how much energy a person would use up during an exercise session.

입력

Input will consists of a number of scenarios, each representing a machine and a number of people using the machine for exercise. Each scenario will begin with an integer, n, the number of levels available on the machine (0 < n < 10). The next n lines define the energy expended per minute at one level of the machine. The first line represents level 1, the second level 2 and so on.

There then follows data about a number of people who are exercising on the machine described. The first line of data gives the name of the person who is exercising (a single series of between 2 and 10 letters, lower case except for the first) followed by a space, followed by e, the number of exercises the person carried out (0 < e <= 50).

The next e lines contain the exercises carried out by the person. These consist of an integer giving the level, followed by a space, followed by d, the duration of the exercise in minutes.

The list of people is terminated by a line containing # 0. This line should not be processed.

Input is terminated by a scenario where n is 0 – this scenario should not be processed.

출력

Output is in sections, one section for each machine. Machines must be numbered, starting at 1. For each machine, one line is output for each person using the machine. This output is the name of the person, followed by a space, followed by the total amount of energy they expended carrying out their set of exercises. The people should be output in the order they appear in the input.

제한

예제 입력 1

3
10
20
30
Bill 3
1 5
2 20
1 5
Jason 2
1 10
3 30
# 0
2
50
25
Susan 4
1 5
2 20
1 5
2 15
Li 2
2 20
1 60
# 0
0

예제 출력 1

Machine 1
Bill 500
Jason 1000
Machine 2
Susan 1375
Li 3500

힌트

출처

ICPC > Regionals > South Pacific > South Pacific Region > New Zealand Programming Contest > NZPC 2008 H번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /