Files
python/TangDou/AcWing_TiGao/T5/JuZhengChengFa/P3193_BF.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

31 lines
502 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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;
}