From aaa4aed3fa10c8b3f6f2c4948a8f4579fd22eb1d Mon Sep 17 00:00:00 2001 From: Jihoon Lee Date: Wed, 21 Feb 2024 20:50:56 +0900 Subject: [PATCH] Add 01086.cpp --- 01xxx/01086.cpp | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 01xxx/01086.cpp diff --git a/01xxx/01086.cpp b/01xxx/01086.cpp new file mode 100644 index 00000000..af7afd7c --- /dev/null +++ b/01xxx/01086.cpp @@ -0,0 +1,56 @@ +#include +#include +#include +using namespace std; + +long long gcd(long long a, long long b) { + return b ? gcd(b, a % b) : a; +} + +void solve(void) { + int n; cin >> n; + vector s(n); + for (int i=0; i> s[i]; + int k; cin >> k; + + vector a(n, 0); + for (int i=0; i ten(55, 1 % k); + for (int i=1; i<55; i++) { + ten[i] = (10 * ten[i-1]) % k; + } + + vector> dp(1<(k, 0)); + dp[0][0] = 1; + for (int mask=0; mask<(1<