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

14293번 - Beautiful Numbers (Large) 다국어

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

문제

We consider a number to be beautiful if it consists only of the digit 1 repeated one or more times. Not all numbers are beautiful, but we can make any base 10 positive integer beautiful by writing it in another base.

Given an integer N, can you find a base B (with B > 1) to write it in such that all of its digits become 1? If there are multiple bases that satisfy this property, choose the one that maximizes the number of 1 digits.

입력

The first line of the input gives the number of test cases, T. T test cases follow. Each test case consists of one line with an integer N.

Limits

  • 1 ≤ T ≤ 100.
  • 3 ≤ N ≤ 1018.

출력

For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is the base described in the problem statement.

제한

예제 입력 1

2
3
13

예제 출력 1

Case #1: 2
Case #2: 3

힌트

In case #1, the optimal solution is to write 3 as 11 in base 2.

In case #2, the optimal solution is to write 13 as 111 in base 3. Note that we could also write 13 as 11 in base 12, but neither of those representations has as many 1s.

출처

Contest > Google > Google's Coding Competitions > Google APAC 2017 University Test > Round E APAC Test 2017 B2번

Contest > Google > Kick Start > Google Kick Start 2016 > Round E B2번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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