CF1808E1.Minibuses on Venus (easy version)
普及/提高-
通过率:0%
时间限制:3.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
This is the easy version of the problem. The only difference between the three versions is the constraints on n and k. You can make hacks only if all versions of the problem are solved.
Maxim is a minibus driver on Venus.
To ride on Maxim's minibus, you need a ticket. Each ticket has a number consisting of n digits. However, as we know, the residents of Venus use a numeral system with base k, rather than the decimal system. Therefore, the ticket number can be considered as a sequence of n integers from 0 to k−1, inclusive.
The residents of Venus consider a ticket to be lucky if there is a digit on it that is equal to the sum of the remaining digits, modulo k. For example, if k=10, then the ticket 7135 is lucky because 7+1+5≡3(mod10). On the other hand, the ticket 7136 is not lucky because no digit is equal to the sum of the others modulo 10.
Once, while on a trip, Maxim wondered: how many lucky tickets exist? At the same time, Maxim understands that this number can be very large, so he is interested only in the answer modulo some prime number m.

这是本题的简单版本。三个版本之间的唯一区别在于 n 和 k 的约束条件不同。仅当三个版本均被解决时,才允许进行 Hack。
马克西姆是金星上的一名小型巴士司机。
乘坐马克西姆的小型巴士需要一张车票。每张车票包含一个由 n 位数字组成的号码。然而,众所周知,金星居民使用的是以 k 为底的进位制,而非十进制。因此,该车票号码可视为一个由 n 个整数组成的序列,每个整数取值范围为 0 到 k−1(含端点)。
金星居民认为一张车票是“幸运的”,当且仅当其某一位数字等于其余所有位数字之和对 k 取模的结果。例如,若 k=10,则车票 7135 是幸运的,因为 7+1+5≡3(mod10);而车票 7136 不是幸运的,因为没有任何一位数字等于其余各位数字之和对 10 取模的结果。
某次出车途中,马克西姆忽然想到:究竟有多少张幸运车票?同时,马克西姆意识到这个数目可能非常大,因此他只关心答案对某个质数 m 取模的结果。

输入格式
The only line of the input contains three integers n, k and m (1≤n≤100, 1≤k≤30, 108≤m≤109+7, m is a prime number) — the number of digits on the ticket, the base of the numeral system on Venus, and the module for answer calculation.
输入仅包含一行,三个整数 n、k 和 m(1≤n≤100,1≤k≤30,108≤m≤109+7,且 m 为质数)——分别表示票号的位数、金星上所用进制系统的基数,以及答案计算时所用的模数。
输出格式
Print one integer — the number of lucky tickets modulo m, i. e. the remainder after dividing the answer by m.
输出一个整数——幸运车票的数量对 m 取模的结果,即答案除以 m 后的余数。
输入输出样例
输入#1
3 2 1000000007
输出#1
4
输入#2
3 4 1000000007
输出#2
28
说明/提示
In the first example, there are only four lucky tickets: 000, 011, 101, and 110.
在第一个例子中,仅有四张幸运票:000、011、101 和 110。
输入解题思路,AI测评打分。不知道怎么写?