CF900D.Unusual Sequences

普及+/提高

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Count the number of distinct sequences _a_1, _a_2, ..., a__n (1 ≤ a__i) consisting of positive integers such that gcd(_a_1, _a_2, ..., a__n) = x and . As this number could be large, print the answer modulo 109 + 7.

gcd here means the greatest common divisor.

计算满足以下条件的互不相同的序列 a1,a2,…,ana_1, a_2, \dots, a_n(其中每个 aia_i 均为正整数)的个数:gcd⁡(a1,a2,…,an)=x\gcd(a_1, a_2, \dots, a_n) = x,且 。由于该数目可能很大,请输出其对 109+710^9 + 7 取模的结果。

此处 gcd⁡\gcd 表示最大公约数。

输入格式

The only line contains two positive integers x and y (1 ≤ x, y ≤ 109).

唯一的一行包含两个正整数 xx 和 yy(1 ≤ x, y ≤ 1091 \le x, y \le 10^9)。

输出格式

Print the number of such sequences modulo 109 + 7.

输出满足条件的序列数量对 109+710^9 + 7 取模的结果。

输入输出样例

  • 输入#1

    3 9

    输出#1

    3
  • 输入#2

    5 8

    输出#2

    0

说明/提示

There are three suitable sequences in the first test: (3, 3, 3), (3, 6), (6, 3).

There are no suitable sequences in the second test.

第一个测试中有三个合适的序列:(3, 3, 3)(3,\,3,\,3)、(3, 6)(3,\,6)、(6, 3)(6,\,3)。

第二个测试中没有合适的序列。

输入解题思路,AI测评打分。不知道怎么写?

首页