给定正整数 $n, k$,求不定方程 $a^k - b^k = n$ 的正整数解的个数。
输入格式
第一行包含一个整数 $T$ ($1 \le T \le 20$),表示查询次数。接下来的 $T$ 行,每行包含两个整数 $n, k$,表示单次查询。保证 $1 \le n \le 10^{18}$,$3 \le k \le 64$。
输出格式
对于每个查询,输出一行,包含一个整数,表示答案。
样例
输入 1
3 7 3 15 4 31 5
输出 1
1 1 1
给定正整数 $n, k$,求不定方程 $a^k - b^k = n$ 的正整数解的个数。
第一行包含一个整数 $T$ ($1 \le T \le 20$),表示查询次数。接下来的 $T$ 行,每行包含两个整数 $n, k$,表示单次查询。保证 $1 \le n \le 10^{18}$,$3 \le k \le 64$。
对于每个查询,输出一行,包含一个整数,表示答案。
3 7 3 15 4 31 5
1 1 1
The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.
This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.
If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.
Guidelines: