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

17795번 - Ballpark Estimate 다국어

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

문제

Giving the right level of detail is an important skill for efficient communication. Sometimes, only the high-level message matters.

For example, whenever a person asks for a number, often they just want an estimate. If the value is in the millions, they do not need to know the precise number of hundreds and tens. Likewise, if the value is in the billions, they do not necessarily care about little things like millions.

Figure B.1: Illustration of ballpark figures versus actual figures, as a log chart.

Given a (possibly very large) number, print its numerically closest representation that has only one digit other than trailing zeroes.

The closeness of the representation r of a number n is defined by abs(r − n).

입력

The input consists of:

  • one line with the positive integer n (1 ≤ n ≤ 1018).

출력

Output the closest number to n with exactly one significant (non-zero) figure. If there are two equally-close answers, print the larger one.

제한

예제 입력 1

150

예제 출력 1

200

예제 입력 2

4

예제 출력 2

4

예제 입력 3

33471234512345

예제 출력 3

30000000000000

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > The UK & Ireland Programming Contest > UKIEPC 2019 B번

  • 문제를 만든 사람: Jim Grimmett
(追記) (追記ここまで)

출처

대학교 대회

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

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