問題一覧 > 教育的問題

No.2087 Base Conversion

レベル : / AI推定難易度 : 167 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 162
作問者 : 👑 p-adic / テスター : 👑 qand
お気に入りにしたユーザー ProblemId : 8379 / 自分の提出
問題文最終更新日: 2022-09-30 23:21:08
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 362 (順位表) の他の問題:

Note

After the contest ended, the input format was changed to use KaTeX. The content of the problem itself has not changed.

 

Problem Statement

You are given as input an integer $N$ (written in decimal) between $2$ and $10$, inclusive, and a non-negative integer $M$ (written in decimal).

 

Express $M$ in base $N$.

 

This is a typical problem that also appears in high school textbooks, but let's review it, considering it an important first step toward understanding base $p$.

Input

The input is given from standard input in the following format:

$N$
$M$

Constraints

The inputs $N,M$ satisfy the following constraints:

  • $N$ is a non-negative integer between $2$ and $10$, inclusive
  • $M$ is a non-negative integer at most $10^9$

Output

Output $M$ expressed in base $N$ on $1$ line.

Print a newline at the end.

Sample

Sample 1
Input
2
2
Output
10

Decimal $2$ is $10$ in binary.

Sample 2
Input
3
2
Output
2

Decimal $2$ is $2$ in ternary. As this shows, the representation may stay the same.

Sample 3
Input
3
9
Output
100

Decimal $9$ is $100$ in ternary. What a nice round number.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。