CF1559E.Mocha and Stars
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Mocha wants to be an astrologer. There are n stars which can be seen in Zhijiang, and the brightness of the i -th star is ai .
Mocha considers that these n stars form a constellation, and she uses (a1,a2,…,an) to show its state. A state is called mathematical if all of the following three conditions are satisfied:
- For all i ( 1≤i≤n ), ai is an integer in the range [li,ri] .
- i=1∑nai≤m .
- gcd(a1,a2,…,an)=1 .
Here, gcd(a1,a2,…,an) denotes the greatest common divisor (GCD) of integers a1,a2,…,an .
Mocha is wondering how many different mathematical states of this constellation exist. Because the answer may be large, you must find it modulo 998244353 .
Two states (a1,a2,…,an) and (b1,b2,…,bn) are considered different if there exists i ( 1≤i≤n ) such that ai=bi .
输入格式
The first line contains two integers n and m ( 2≤n≤50 , 1≤m≤105 ) — the number of stars and the upper bound of the sum of the brightness of stars.
Each of the next n lines contains two integers li and ri ( 1≤li≤ri≤m ) — the range of the brightness of the i -th star.
输出格式
Print a single integer — the number of different mathematical states of this constellation, modulo 998244353 .
输入输出样例
输入#1
2 4 1 3 1 2
输出#1
4
输入#2
5 10 1 10 1 10 1 10 1 10 1 10
输出#2
251
输入#3
5 100 1 94 1 96 1 91 4 96 6 97
输出#3
47464146
说明/提示
In the first example, there are 4 different mathematical states of this constellation:
- a1=1 , a2=1 .
- a1=1 , a2=2 .
- a1=2 , a2=1 .
- a1=3 , a2=1 .