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

24739번 - Sequinary Numerals 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB133886967.647%

문제

A sequinary numeral is a sequence of digits:

dndn-2...d1d0

where dn is 1 or 2 and the others are 0, 1, or 2.

It represents the rational number:

d0 + d1 * (3/2) + d2 * (3/2)2 + ... + dn * (3/2)n

Write a program which takes a sequinary numeral as input and returns the number it represents as a proper fraction.

입력

The single line of input contains a sequinary numeral of no more than 32 digits.

출력

Output consists of a single line.

If the result is an integer, the output is the decimal integer. Otherwise, the output is N a single space and K/M where N, K and M are decimal integers where K < M and K/M is in lowest terms (GCD(K, M) = 1).

제한

예제 입력 1

2101

예제 출력 1

10

예제 입력 2

201

예제 출력 2

5 1/2

힌트

출처

ICPC > Regionals > North America > Greater New York Region > 2021 Greater New York Programming Contest D번

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

출처

대학교 대회

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

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