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

11643번 - The Magical 3 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 256 MB205514125.949%

문제

There’s no doubt about it, three is a magical number. Two’s company, but three’s a crowd, no one ever talks about 2 blind mice, and there are three members in an ACM ICPC team.

Even more magically, almost all integers can be represented as a number that ends in 3 in some numeric base, sometimes in more than one way. Consider the number 11, which is represented as 13 in base 8 and 23 in base 4. For this problem, you will find the smallest base for a given number so that the number’s representation in that base ends in 3.

입력

Each line of the input contains one nonnegative integer n. The value n = 0 represents the end of the input and should not be processed. All input integers are less than 231. There are no more than 1 000 nonzero values of n.

출력

For each nonzero value of n in the input, print on a single line the smallest base for which the number has a representation that ends in 3. If there is no such base, print instead “No such base”.

제한

예제 입력 1

11
123
104
2
3
0

예제 출력 1

4
4
101
No such base
4

힌트

출처

ICPC > Regionals > North America > Rocky Mountain Regional > 2015 Rocky Mountain Regional Contest H번

ICPC > Regionals > North America > Southeast USA Regional > 2015 Southeast USA Regional Programming Contest > Division 1 G번

ICPC > Regionals > North America > Southeast USA Regional > 2015 Southeast USA Regional Programming Contest > Division 2 H번

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

출처

대학교 대회

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

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