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

15084번 - Treating Fractions Irrationally 다국어

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

문제

Anna has a big report to write concerning the voting habits of left-handed Democrats who own one or more kitchen blenders. She has a lot of statistics to report. For example, did you know that 56 out of every 87 left-handed Democrats who own one or more kitchen blenders can not name any of the current Supreme Court justices (yes, we were a bit shocked by this too.)

Now Anna is a bit irrational when it comes to fractions. She hates writing them as “56/87” but prefers the floating point version “0.64367816091954022...”

But this presents two problems. The first is that for most fractions, the floating point version will have to be truncated at some point. And this leads to the second problem: this truncated version is never equal to the original fraction. To minimize this second problem, Anna has decided that she will print the floating point version up to (but not including) the first 0 or 9 encountered, rounding down or up appropriately. So the above fraction would be written as “0.64367816”, while the fraction 55/87 (which is equal to 0.6321839080459...) would be written as “0.632184”. If the very first digit after the decimal point is 0 (as with the fraction 1/87) then Anna just writes “0”; if the first digit after the decimal point is 9 (as with the fraction 86/87) then Anna just writes “1”. Finally if a 0 or 9 never appears in the floating point version (as with the fraction 58/87) then Anna just throws out that data (so the world will never know, for example, that 58 out of every 87 left-handed Democrats who own one or more kitchen blenders make great fruit smoothies).

입력

Input consists of a single line containing two positive integers n d, where n < d ≤ 100000.

출력

Display Anna’s truncated version of the fraction n/d. If the floating point version of n/d does not contain a 0 or 9, display the phrase throw out.

제한

예제 입력 1

56 87

예제 출력 1

0.64367816

예제 입력 2

55 87

예제 출력 2

0.632184

예제 입력 3

58 87

예제 출력 3

throw out

예제 입력 4

1 87

예제 출력 4

0

힌트

출처

ICPC > Regionals > North America > East Central North America Regional > 2017 East Central Regional Contest 연습 세션 PF번

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

출처

대학교 대회

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

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