結果
問題 | No.416 旅行会社 |
ユーザー | pekempey |
提出日時 | 2016-10-29 07:25:15 |
言語 | C++11 (gcc 11.4.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 568 bytes |
コンパイル時間 | 1,356 ms |
コンパイル使用メモリ | 144,572 KB |
実行使用メモリ | 4,388 KB |
最終ジャッジ日時 | 2023-08-15 22:18:31 |
合計ジャッジ時間 | 4,220 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
ソースコード
#include <bits/stdc++.h> const int mod = 1e9 + 7; char S[10001]; int M; int64_t dp0[20000], dp1[20000]; int main() { scanf("%s %d", S, &M); int n = strlen(S), d = 10 % M; int zero = 0; for (int i = 0; i < n; i++) S[i] -= '0', zero += S[i] == 0; for (int i = 0; i < n; i++) { memcpy(dp1, dp0, sizeof(dp1)); if (S[i] != 0) dp0[S[i] % M]++; for (int j = 0; j < M; j++) dp0[(j * 10 + S[i]) % M] += dp1[j]; if (i % 16 == 0) for (int j = 0; j < M; j++) dp0[i] %= mod; } printf("%lld\n", (dp0[0] + zero) % mod); }