結果

問題 No.1086 桁和の桁和2
ユーザー QCFiumQCFium
提出日時 2020-06-15 22:20:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 809 bytes
コンパイル時間 1,413 ms
コンパイル使用メモリ 166,060 KB
実行使用メモリ 5,484 KB
最終ジャッジ日時 2023-09-16 10:35:12
合計ジャッジ時間 7,098 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 87 ms
5,476 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 55 ms
4,876 KB
testcase_11 AC 16 ms
4,380 KB
testcase_12 AC 4 ms
4,380 KB
testcase_13 AC 69 ms
5,000 KB
testcase_14 AC 44 ms
4,488 KB
testcase_15 AC 12 ms
4,380 KB
testcase_16 AC 61 ms
4,896 KB
testcase_17 AC 6 ms
4,376 KB
testcase_18 WA -
testcase_19 AC 69 ms
5,084 KB
testcase_20 AC 10 ms
4,376 KB
testcase_21 AC 60 ms
4,816 KB
testcase_22 AC 84 ms
5,428 KB
testcase_23 AC 52 ms
4,820 KB
testcase_24 AC 36 ms
4,380 KB
testcase_25 AC 71 ms
5,116 KB
testcase_26 AC 58 ms
4,848 KB
testcase_27 AC 42 ms
4,416 KB
testcase_28 AC 36 ms
4,380 KB
testcase_29 WA -
testcase_30 AC 86 ms
5,480 KB
testcase_31 AC 87 ms
5,484 KB
testcase_32 WA -
testcase_33 AC 87 ms
5,416 KB
testcase_34 AC 87 ms
5,484 KB
testcase_35 AC 87 ms
5,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

#define MOD 1000000007

int mpow(int a, int64_t b) {
	b %= 1000000006;
	int res = 1;
	for (; b; b >>= 1) {
		if (b & 1) res = (int64_t) res * a % MOD;
		a = (int64_t) a * a % MOD;
	}
	return res;
}

int main() {
	int n = ri();
	int64_t l[n], r[n];
	int d[n];
	for (auto &i : l) scanf("%" SCNd64, &i);
	for (auto &i : r) scanf("%" SCNd64, &i);
	for (auto &i : d) i = ri();
	
	int head = 0;
	while (head < n && !d[head]) head++;
	
	int res = 1;
	for (int i = head; i < n; i++) {
		if (!d[i]) res = 0;
		int diff = (d[i] - (i ? d[i - 1] : 0)) % 9;
		int times = !diff + (int64_t) (mpow(10, r[i]) - mpow(10, l[i])) * 111111112 % MOD;
		res = (int64_t) res * times % MOD;
	}
	if (res < 0) res += MOD;
	printf("%d\n", res);
	return 0;
}

0