問題一覧 > 通常問題

No.3156 Count That Day's N

レベル : / AI推定難易度 : 500 / 実行時間制限 : 1ケース 3.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 120
作問者 : tatesoto / テスター : TKTYI 👑 みうね jastaway 👑 kencho fluorine kmmtkm butsurizuki
お気に入りにしたユーザー ProblemId : 12232 / 自分の提出
問題文最終更新日: 2025-05-23 19:00:57
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
KCPC新歓杯 -Happy Birthday physics0523- (順位表) の他の問題:

Problem Statement

You are given positive integers $K$, $N$.
When a positive integer $n$ satisfies the following condition, $n$ is called a good number.

  • It can be expressed as $n = K z^2 = x^6 + y^4$ using positive integers $x, y, z$.
Find how many of the positive integers less than or equal to $N$ are good numbers.

Constraints

  • $1 \le K \le N \le 10^{15}$
  • All input values are integers.

Input

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

$K\ N$

Output

Print the answer. Print a newline at the end.

Sample

Sample 1
Input
9 10000
Output
1

For this input case, the condition for $n$ to be a good number is that "it can be expressed as $n = 9z^2 = x^6 + y^4$ using positive integers $x, y, z$".
Among the positive integers less than or equal to $N = 10000$, the only good number is $2025\ (= 9\cdot 15^2 = 3^6 + 6^4)$, so print $1$.

Sample 2
Input
4097 4097
Output
1

Sample 3
Input
3 1000000000000000
Output
0

Input values may not fit in a 32-bit integer type.

Sample 4
Input
9 1000000000000000
Output
43

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