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

27854번 - Exact? Approximate! 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
10 초 1024 MB5722100.000%

문제

Different people have different notions of entertainment. Some need the most incredible gadgets to play with, others are able to find pleasure in common everyday devices. This problem is dedicated to those, who have ever been amused by a pocket calculator (which is, unofficially, considered to be the 23rd most entertaining invention in the modern history of mankind).

One of the most popular calculator games has the following rules. Given a positive number X with D digits after the decimal point. Your task is to find a fraction A/B (where A and B are positive integers), that approximates the number X. More exactly, the value of A/B rounded to D digits after the decimal point must be exactly X. Moreover, we require that B is as small as possible. Note that the fraction A/B we seek is now unique.

Common rounding rules apply, i.e. 0-4 rounds down, 5-9 up. Thus:

  • 1/3 rounded to 3 decimal places is 0.333
  • 2/3 rounded to 3 decimal places is 0.667
  • 5/10000 rounded to 3 decimal places is 0.001
  • 5/10001 rounded to 3 decimal places is 0.000

입력

The input file consists of several lines. The i-th line contains one positive real number Xi in decimal notation. You can assume that Xi is less than one. Note that trailing zeroes are significant.

출력

For each line, output two positive integers A and B (separated by a single space character), such that the fraction A/B meets the requirements stated above.

제한

서브태스크

번호배점제한
Easy1

All Xi are given with at most 9 decimal places after the decimal point.

Hard2

All Xi are given with at most 515 decimal places after the decimal point.

예제 입력 1

0.333333333333333333333
0.40000000
0.7
0.70

예제 출력 1

1 3
2 5
2 3
7 10

힌트

출처

Contest > Internet Problem Solving Contest > IPSC 2005 E번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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