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

15068번 - Time is of the Essence 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB98231728.814%

문제

Do you know how long one million seconds is? How about one billion seconds? Well, the answer to the first one is

11 days, 13 hours, 46 minutes and 40 seconds

Accurate, but a little over-precise. A more reasonable answer might be “11 days, 14 hours" or just “12 days" (after rounding). As another example, if I asked how long three million inches were, you could approximate it by saying either “47 miles" or “47 miles, 613 yards". This sort of imprecision is what we’re looking for in this problem!

입력

Input consists of two lines. The first line has the form

n name1 c1 name2 c2 . . . namen−1 cn−1 namen

Each namei is a unit of measurement and each ci is a conversion rate, telling you how many units of type namei+1 are in a unit of type namei. For example, in the first sample input, this line tells you that there are 24 hours in one day, 60 minutes in each hour and 60 seconds in each minute. The value n indicates the total number of unit names and satisfies 2 ≤ n ≤ 10. All names are alphabetic strings with no blanks and always specify the plural form of the unit (which you should use for output no matter the value is associated with the unit). All conversion values are positive integers. Following this line is a single positive integer m ≤ 2,000,000,000 indicating an amount of the last unit (i.e., namen).

출력

Display two lines. The first line should give the closest conversion of the input amount to units specified by name1, rounded to the nearest integer. The second line should do the same, but be a bit more precise using the two largest units – name1 and name2. When rounding, always round up when the fraction is ≥ 0.5. Note that there are no commas in the output.

제한

예제 입력 1

4 days 24 hours 60 minutes 60 seconds
1000000

예제 출력 1

12 days
11 days 14 hours

예제 입력 2

5 years 365 days 24 hours 60 minutes 60 seconds
1000000000

예제 출력 2

32 years
31 years 259 days

예제 입력 3

2 feet 12 inches
11

예제 출력 3

1 feet
0 feet 11 inches

예제 입력 4

4 jiffys 2 lambtailshakes 11 flashes 3 twinklings
20902

예제 출력 4

317 jiffys
316 jiffys 1 lambtailshakes

힌트

출처

ICPC > Regionals > North America > East Central North America Regional > 2016 East Central Regional Contest 연습 세션 PD번

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

출처

대학교 대회

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

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