結果

問題 No.1086 桁和の桁和2
ユーザー milanis48663220milanis48663220
提出日時 2020-06-19 23:21:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,210 bytes
コンパイル時間 838 ms
コンパイル使用メモリ 83,364 KB
実行使用メモリ 5,988 KB
最終ジャッジ日時 2023-09-16 15:35:52
合計ジャッジ時間 4,735 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,356 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 WA -
testcase_04 AC 1 ms
4,380 KB
testcase_05 WA -
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 15 ms
4,376 KB
testcase_16 AC 82 ms
5,028 KB
testcase_17 AC 8 ms
4,376 KB
testcase_18 WA -
testcase_19 AC 93 ms
5,260 KB
testcase_20 AC 13 ms
4,376 KB
testcase_21 AC 80 ms
4,996 KB
testcase_22 AC 112 ms
5,616 KB
testcase_23 AC 69 ms
4,816 KB
testcase_24 AC 48 ms
4,388 KB
testcase_25 AC 95 ms
5,256 KB
testcase_26 AC 78 ms
4,912 KB
testcase_27 AC 57 ms
4,496 KB
testcase_28 AC 48 ms
4,468 KB
testcase_29 WA -
testcase_30 AC 115 ms
5,700 KB
testcase_31 AC 115 ms
5,816 KB
testcase_32 WA -
testcase_33 AC 115 ms
5,716 KB
testcase_34 AC 116 ms
5,692 KB
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;
const ll MOD = 1000000007;

template <typename T>
T pow(T a, ll n) {
	T ans = 1;
	T tmp = a;
	for (int i = 0; i <= 60; i++) {
		ll m = (ll)1 << i;
		if (m & n) {
		ans *= tmp;
		ans %= MOD;
		}
		tmp *= tmp;
		tmp %= MOD;
	}
	return ans;
}

ll inv(ll n){
    if(n == 1) return 1;
    else return MOD-inv(MOD%n)*(MOD/n)%MOD;
}


int N;
ll L[100000], R[100000], D[100000];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> N;
    for(int i = 0; i < N; i++) cin >> L[i];
    for(int i = 0; i < N; i++) cin >> R[i];
    for(int i = 0; i < N; i++) cin >> D[i];
    ll ans = 1;
    int prev = 0;
    for(int i = 0; i < N; i++){
        if(D[i] == 0){
            ans = 1;
        }else{
            ll r = pow<ll>(10, R[i]);
            ll l = pow<ll>(10, L[i]);
            ll d = (r-l+MOD)%MOD;
            ll tmp = (d*inv(9))%MOD;
            if(D[i]%9 == prev%9) tmp++;
            ans *= tmp;
            ans %= MOD;
        }
        prev = D[i];
    }
    cout << ans << endl;
}
0