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

16861번 - Harshad Numbers 다국어

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

문제

We’re all familiar with harshad numbers. For this problem, you will ... what’s that? You aren’t familiar with harshad numbers? They’re also known as Niven numbers – does that ring a bell?? Anything???

Well, it’s a simple enough concept. A harshad number is a number which is evenly divisible by the sum of its digits. For example, 24 is a harshad number: the sum of its digits is 2 + 4 = 6 and 24 is divisible by 6. 156 is also a harshad number, since 1 + 5 + 6 = 12 and 156 = (12)(13). 157 is NOT a harshad number since it is not divisible by 1 + 5 + 7 = 13.

OK, let’s start over.

We’re all familiar with harshad numbers. For this problem, you will be given a number n and must find the smallest harshad number ≥ n.

입력

Input consists of a single line containing a positive integer n ≤ 1 000 000 000.

출력

Display the smallest harshad number greater than or equal to n.

제한

예제 입력 1

24

예제 출력 1

24

예제 입력 2

25

예제 출력 2

27

예제 입력 3

987654321

예제 출력 3

987654330

힌트

출처

ICPC > Regionals > North America > East Central North America Regional > 2018 East Central Regional Contest 연습 세션 PB번

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

출처

대학교 대회

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

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