From 641edbefc9e8a7d28fbd545e5c3737af1d5166ab Mon Sep 17 00:00:00 2001 From: hanyixuanten <105723997+hanyixuanten@users.noreply.github.com> Date: Thu, 10 Sep 2026 19:40:33 +0800 Subject: [PATCH] new file: P9752.cpp --- P9752.cpp | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 P9752.cpp diff --git a/P9752.cpp b/P9752.cpp new file mode 100644 index 0000000..ec25145 --- /dev/null +++ b/P9752.cpp @@ -0,0 +1,49 @@ +#include +using namespace std; +int n; +int aa[10]; +bool pd(int now) +{ + for (int i = 1; i <= n; ++i) + { + int acpy = aa[i]; + int pp = 0; + int cha = 0; + int ncpy = now; + int xl = 0; + for (int j = 1; j <= 5; ++j) + { + if (acpy % 10 != ncpy % 10) + { + pp++; + + if (pp == 1) + cha = ((acpy % 10 - ncpy % 10) + 10) % 10, xl = j; + + else if (((acpy % 10 - ncpy % 10) + 10) % 10 != cha || abs(j - xl) != 1) return 0; + } + acpy /= 10, ncpy /= 10; + } + if (pp > 2 || pp == 0) + return 0; + } + return 1; +} +int main() +{ + scanf("%d", &n); + for (int i = 1; i <= n; ++i) + { + int a, b, c, d, e; + scanf("%d%d%d%d%d", &a, &b, &c, &d, &e); + aa[i] = 10000 * a + 1000 * b + 100 * c + 10 * d + e; + } + int ans = 0; + for (int i = 0; i <= 99999; i++) + { + if (pd(i)) + ans++; + } + printf("%d\n", ans); + return 0; +} \ No newline at end of file