Pagini recente » Cod sursa (job #1543205) | Cod sursa (job #487243) | Cod sursa (job #1799935) | Cod sursa (job #2416533) | Cod sursa (job #2618834)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("diviz.in");
ofstream fout("diviz.out");
const int nmax = 200, mod = 30103;
int k, a, b, n, v[nmax + 5], dp[11][nmax + 3][103], pos[10][nmax + 3], aux[nmax + 5][nmax + 5];
char ch;
int main()
{
fin >> k >> a >> b;
while (fin >> ch) v[++n] = ch - '0';
for (int index = n; index >= 1; --index)
{
for (int nr = k - 1; nr >= 0; --nr)
{
for (int cif = n; cif >= 1; --cif)
{
if (v[index] == 0 && cif == 1) continue;
int new_nr = (nr * 10 + v[index]) % k;
for (int c = 0; c <= 9; ++c)
aux[cif][nr] = (1LL * aux[cif][nr] + dp[c][cif + 1][new_nr]) % mod;
}
}
}
fout << 4;
fin.close();
fout.close();
return 0;
}