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

4144번 - Alien Communicating Machines 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB191897547.771%

문제

Aliens on the planet Hex have sixteen fingers. As a result, they have developed a system of writing numbers with sixteen digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, in ascending order). Like the decimal system that we use, a number is written as a sequence of digits, and the value of a number is determined by the following rules:

  • The value of a single-digit number is just the value of that digit.
  • The value of number a consisting of a number b followed by a digit d is the value of b multiplied by a fixed base, plus the value of d. In our decimal system, the base is ten, whereas in the system used by the Hex aliens, the base is sixteen.

Still other planets have other aliens with different numbers of fingers. These aliens use the same rules for writing numbers, but each uses a different base.

You have the important job of promoting universal peace by improving communication among all of these aliens. Specifically, you are to write a program that translates numbers written by one alien into numbers that can be understood by a different alien.

입력

The first line of input contains a single integer, the number of test cases to follow. Each test case is a single line containing three numbers x, y, and z. Both x and y are written in decimal, and are the bases used by the two aliens. Each is at least two and at most thirty-six. The number z is written in base x, using the letters A through Z as the digits with value 10 through 35. The number z will be no greater than four billion.

출력

For each line of input, output a line containing a single number, equal in value to z, but written in base y.

제한

예제 입력 1

1
16 10 11

예제 출력 1

17

힌트

출처

Contest > Waterloo's local Programming Contests > 24 September, 2011 B번

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

출처

대학교 대회

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

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