QOJ.ac

QOJ

시간 제한: 3 s 메모리 제한: 512 MB 총점: 100

#1254. Tập hợp lớn nhất từ trước đến nay

통계

Một tập hợp các số nguyên không âm được gọi là tốt khi và chỉ khi mọi số trong tập đều nhỏ hơn $T$ và tổng của chúng đồng dư với $rem$ theo modulo $n$. Nhiệm vụ của bạn là tìm số tập hợp tốt khác nhau.

Dữ liệu vào

Dòng đầu tiên của dữ liệu vào chứa các số nguyên $n$ và $rem$ cách nhau bởi dấu cách ($0 \le rem < n \le 10^4$). Dòng thứ hai của dữ liệu vào chứa một số nguyên $T$ ($1 \le T \le 10^{100\,000} - 1$).

Dữ liệu ra

In ra số tập hợp tốt khác nhau. Vì số này có thể rất lớn, hãy in phần dư của nó khi chia cho số nguyên tố $998\,244\,353$.

Ví dụ

Dữ liệu vào 1

3 2
5

Dữ liệu ra 1

8

Dữ liệu vào 2

1 0
20

Dữ liệu ra 2

1048576

Ghi chú

Trong ví dụ thứ nhất, ta có thể tùy ý chọn hoặc không chọn các số $0$ và $3$ mà không làm thay đổi số dư. Từ các số $\{1, 2, 4\}$, có hai tập hợp tốt: $\{2\}$ và $\{1, 4\}$. Vì vậy, đáp án là $2 \cdot 2 \cdot 2 = 8$.

Trong ví dụ thứ hai, bất kỳ tập con nào của $\{0, 1, \ldots, 19\}$ đều tốt, do đó đáp án là $2^{20} = 1\,048\,576$.

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.