QOJ.ac

QOJ

Time Limit: 1.5 s Memory Limit: 1024 MB Total points: 100

#1641. 拆分整数

統計

考虑全体 $n$ 个元素的多重集,且集合中每个数都为 $2^i(i\in (-\infty,0] \cap \mathbb Z)$,请问有多少个集合满足集合内所有数的和等于 $k$?你只需要将答案取模 $998244353$。

输入格式

第一行输入两个正整数 $N,Q$,表示 $n$ 的范围以及询问次数。

接下来 $Q$ 行,每行两个正整数 $n,k$,保证 $n\ge k$。

输出格式

输出 $Q$ 行,每行一个整数表示方案数取模 $998244353$。

样例数据

样例 1 输入

3000000 10
4 1
4 2
4 3
4 4
10 3
100 13
1000 666
100000 99824
1000000 112358
3000000 2999990

样例 1 输出

2
2
1
1
35
69549003
511129129
673402331
520502118
253

子任务

对于 $100\%$ 的数据,保证 $1\le k\le n\le N\le 3\times 10^6$,且 $Q\le 2\times 10^5$。

数据点编号 特殊限制
$1,2$ $N=10$
$3,4$ $N=5\times 10^3$
$5,6$ $Q=1,N=10^5$
$7$ $Q=1$
$8$ $N=10^5$
$9,10$
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.