結果

問題 No.1417 100の倍数かつ正整数(2)
ユーザー magstamagsta
提出日時 2021-03-05 22:56:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,158 bytes
コンパイル時間 679 ms
コンパイル使用メモリ 85,012 KB
実行使用メモリ 19,380 KB
最終ジャッジ日時 2024-04-16 10:56:18
合計ジャッジ時間 1,903 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <vector>
using namespace std;
#define MOD 1000000007

int main() {
	string N; cin >> N;
	long long A = N.size();
	long long dp[10010][100];
	long long dp2[10010][100];
	for (int i = 0; i < A; i++) for (int j = 0; j < 100; j++) dp[i][j] = 0;
	for (int i = 0; i < A; i++) for (int j = 0; j < 100; j++) dp2[i][j] = 0;

	for (int i = 0; i < A; i++) {
		if (i == 0) {
			dp[i][N[i] - '0'] = 1;
			for (int j = 1; j < N[i] - '0'; j++) {
				dp2[i][j] = 1;
			}
		}
		else {
          	for (int j = 1; j < 9; j++) {
              	dp2[i][j] += 1;
            }
			for (int j = 0; j < 100; j++) {
				if (N[i] - '0' != 0) dp[i][j * (N[i] - '0') % 100] += dp[i - 1][j];
				for (int k = 1; k < N[i] - '0'; k++) {
					dp2[i][j * k % 100] += dp[i - 1][j];
				}
				for (int k = 1; k <= 9; k++) {
					dp2[i][j * k % 100] += dp2[i - 1][j];
				}
			}
			for (int j = 0; j < 100; j++) {
				dp[i][j] %= MOD;
				dp2[i][j] %= MOD;
			}
		}
	}

	cout << (dp[A - 1][0] + dp2[A - 1][0]) % MOD << endl;
}
0