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

26324번 - Super Lucky Palindromes 다국어

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

문제

Lucky numbers are positive integers composed only of the digits ‘4’ and ‘7’. For example, 47477 and 777 are lucky numbers while 457 and 1232 are not.

Super lucky numbers have the following additional properties:

  • They are a lucky number themselves
  • Number of digits in them is a lucky number
  • The number of ‘4’s or the number of ‘7’s in them is a lucky number (or both counts are lucky numbers).

A palindrome is an integer that reads the same forwards and backwards. For example, 547745 and 343 are palindromes while 74 and 12345 are not. A super lucky palindrome is a positive integer that is both a super lucky number and a palindrome.

Given a number k, print the k th smallest super lucky palindrome.

입력

The first input line contains a positive integer, n, indicating the quantity of numbers to check. Each of the next n lines contains a single integer, k (1 ≤ k ≤ 1018).

출력

For each query, first output the heading “Query #d: ”, where d is the query number, starting with 1. Then, for the value k given in the query, print the k th smallest super lucky palindrome. Follow the format illustrated in Sample Output.

제한

예제 입력 1

5
1
2
3
5
100

예제 출력 1

Query #1: 4444
Query #2: 7777
Query #3: 4444444
Query #4: 4747474
Query #5: 44444444744744444444444444444444744744444444

힌트

출처

University > University of Central Florida > 2014 Local Programming Contest 11번

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

출처

대학교 대회

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

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