31 lines
502 B
C++
31 lines
502 B
C++
|
|
#include <bits/stdc++.h>
|
|||
|
|
|
|||
|
|
using namespace std;
|
|||
|
|
int n, m, k;
|
|||
|
|
string s;
|
|||
|
|
int res;
|
|||
|
|
/*
|
|||
|
|
4 3 100
|
|||
|
|
111
|
|||
|
|
|
|||
|
|
答案:81
|
|||
|
|
*/
|
|||
|
|
void dfs(int u, string t) {
|
|||
|
|
if (u == n) {
|
|||
|
|
if (t.find(s) == string::npos) res++;
|
|||
|
|
res = res % k;
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
for (int i = 0; i <= 9; i++) {
|
|||
|
|
t.push_back(i + '0');
|
|||
|
|
dfs(u + 1, t);
|
|||
|
|
t.pop_back();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
int main() {
|
|||
|
|
cin >> n >> m >> k;
|
|||
|
|
cin >> s;
|
|||
|
|
dfs(0, "");
|
|||
|
|
printf("%d\n", res);
|
|||
|
|
return 0;
|
|||
|
|
}
|