루미 알고리즘

#1296실버Lamps

PO 2009 학교 예선코딩영어 원문이 문제가 어렵다면 — 배우는 순서 보기

영어 원문입니다. 원문의 수식·표를 글자로 옮겨 모양이 다를 수 있습니다. 정확한 내용은 원문 페이지에서 확인하세요. 원문 페이지 열기 (새 창)

Problem

The use of incandescent light bulbs will soon be banned within the European Union, but it can already be profitable to use low energy lamps. Your task is to write a program that, given for how long a light is on each day and the price of electricity, computes after how many days the total cost of ownership (the purchasing price of the lamp plus the cost of electricity) is lower for the low energy lamp compared to the incandescent light bulb for the first time.

We assume the following data:

Incandescent bulbLow energy lamp
Power (watt)6011
Life (hours)10008000
Price (Swedish kronor)560

For simplicity, we assume that each lamp has the exact given life. This means that if you only need to have a light on for 1000 hours you only need a single incandescent bulb, while you need two if you use it for 1001 hours, since the first breaks after 1000 hours.

The cost of electricity K for a lamp that is on for H hours can be computed with the formula

K = (E · H · P)/100000

where E is the power of the lamp in watt and P is the price of electricity (in hundredths of a krona per kilowatt-hour).

In every test case, it is guaranteed that the low energy lamp becomes cheaper within 8000 hours, i.e. you will never have to buy an additional low energy lamp.

Input

The first and only line of input contains two integers h (1 ≤ h ≤ 24) and P (1 ≤ P ≤ 200), the number of hours per day the lamp is on, and the price of electricity.

Output

Print an integer: the number of days after which the low energy lamp is cheaper than the incandescent bulb.

Scoring

Your solution will be tested on a set of test groups. To earn points for a group, you must pass all test cases in that group.

GroupPointsConstraints
133You will only have to purchase a single incandescent bulb before the low energy lamp becomes cheaper.
267No additional constraints.

Explanation of Sample

After 149 days, the cost of the incandescent bulb is 71.32840 kronor (of which the cost of purchasing two bulbs is 10), and with the low energy lamp 71.24354 kronor (of which the cost of purchasing a single lamp is 60).

예제

예제 1

입력
7 98
출력
149

출처 표기

출처: Programmeringsolympiaden 2009년 학교 예선 · 원문 페이지 · 이용 조건 CC BY-SA · LaTeX 원문을 화면용 글로 옮겼습니다(수식·표의 모양이 다를 수 있습니다). 내용은 고치지 않았습니다.

크리에이티브 커먼즈 저작자표시-동일조건변경허락.

문제 출처: 한국정보올림피아드(KOI) (CC BY-NC-SA 4.0) · International Olympiad in Informatics (IOI) (CC BY) · Centre for Education in Mathematics and Computing (CEMC), University of Waterloo (CC BY-NC 4.0) · Programmeringsolympiaden (CC BY-SA) · CSES Problem Set (Antti Laaksonen) (CC BY-NC-SA 4.0). 루미 알고리즘은 위 단체들과 관계없는 별도의 서비스이며, 자료는 원문 그대로 싣습니다. 문제마다 출처와 이용 조건을 따로 표기합니다.