Files
python/TangDou/AcWing_TiGao/T5/JuZhengChengFa/P3193_BF.cpp

31 lines
502 B
C++
Raw Normal View History

2025-08-30 18:35:01 +08:00
#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;
}