QOJ.ac

QOJ

时间限制: 1 s 内存限制: 256 MB 总分: 100

#3906. 盒子里的物品

统计

你有 $2^n$ 个不同的盒子,每个盒子中包含 $a$ 个不同的物品。求从每个盒子中恰好取出一个物品的方法数,结果对 $2^{n+2}$ 取模。

换句话说,如果所需的方法数为 $x$,请输出 $x$ 除以 $2^{n+2}$ 的余数。

输入格式

输入数据仅一行,包含两个由空格分隔的整数 $n$ 和 $a$。

$1 \le a, n \le 10^9$

输出格式

输出一个数字,即从每个盒子中各取一个物品的方法数除以 $2^{n+2}$ 的余数。

样例

样例输入 1

5 10

样例输出 1

0

样例输入 2

10 5

样例输出 2

1

样例输入 3

1 2

样例输出 3

4

说明

在第三个样例中,$2^n = 2$ 个盒子,每个盒子有 $a = 2$ 个物品。从第一个盒子取出一个物品有 2 种方法,从第二个盒子取出一个物品也有 2 种方法,总共有 $2 \cdot 2 = 4$ 种方法。除以 $2^{n+2} = 2^3 = 8$ 的余数为 4。

Discussions

About Discussions

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.

Open Discussions 0
No discussions in this category.

Issues

About Issues

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:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.