問題一覧 > 教育的問題

No.3355 Integer Part of a Logarithm

レベル : / AI推定難易度 : 353 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 65
作問者 : 👑 p-adic / テスター : 👑 hamamu
お気に入りにしたユーザー ProblemId : 10979 / 自分の提出
問題文最終更新日: 2025-11-08 13:31:50
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 488 小数誤差コンテスト (順位表) の他の問題:

Problem Statement

You are given an integer $N$ greater than or equal to $2$ and a positive integer $M$.

Find $\lfloor \log_N M \rfloor$, the largest integer not exceeding $\log_N M$.

Input

The input is given from Standard Input on $1$ line in the following format:

  • The $1$st line contains $N, M$ separated by a single space.
$N$ $M$

Constraints

The input satisfies the following constraints:

  • $N$ is an integer satisfying $2 \leq N \leq 10^{18}$.
  • $M$ is an integer satisfying $1 \leq M \leq 10^{18}$.

Output

Print $\lfloor \log_N M \rfloor$, the largest integer not exceeding $\log_N M$, on $1$ line.

End the output with a newline.

Sample

Sample 1
Input
2 1
Output
0

The largest integer not exceeding $\log_N M = \log_2 1 = 0$ is $0$.

Sample 2
Input
2 2
Output
1

The largest integer not exceeding $\log_N M = \log_2 2 = 1$ is $1$.

Sample 3
Input
3 2
Output
0

The largest integer not exceeding $\log_N M = \log_3 2 = 0.63 \cdots$ is $0$.

Sample 4
Input
10 10000000000

As in this case, the input may not fit in a 32-bit integer.

Output
10

The largest integer not exceeding $\log_N M = \log_{10} 10^{10} = 10$ is $10$.

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