結果

問題 No.2017 Mod7 Parade
ユーザー otoshigootoshigo
提出日時 2022-07-22 22:47:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 1,282 bytes
コンパイル時間 4,761 ms
コンパイル使用メモリ 261,736 KB
実行使用メモリ 10,592 KB
最終ジャッジ日時 2023-09-17 11:21:34
合計ジャッジ時間 6,215 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,584 KB
testcase_01 AC 2 ms
5,432 KB
testcase_02 AC 2 ms
5,440 KB
testcase_03 AC 54 ms
10,096 KB
testcase_04 AC 37 ms
10,060 KB
testcase_05 AC 29 ms
9,892 KB
testcase_06 AC 59 ms
10,276 KB
testcase_07 AC 10 ms
6,084 KB
testcase_08 AC 35 ms
10,052 KB
testcase_09 AC 15 ms
6,600 KB
testcase_10 AC 35 ms
9,864 KB
testcase_11 AC 47 ms
10,032 KB
testcase_12 AC 43 ms
9,956 KB
testcase_13 AC 67 ms
10,592 KB
testcase_14 AC 67 ms
10,440 KB
testcase_15 AC 67 ms
10,528 KB
testcase_16 AC 67 ms
10,436 KB
testcase_17 AC 67 ms
10,432 KB
testcase_18 AC 64 ms
10,480 KB
testcase_19 AC 29 ms
10,476 KB
testcase_20 AC 2 ms
5,492 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using mint = modint;
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,a,b) for (int i = a; i < b; i++)
#define rrep2(i,a,b) for (int i = a-1; i >= b; i--)
#define rep3(i,a,b,c) for (int i = a; i < b; i+=c)
#define rrep3(i,a,b,c) for (int i = a-1; i >= b; i-=c)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}

const int MOD=1e9+7;

int k;
ll D[100010],L[100010],dp[100010][7];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    modint::set_mod(7);
    cin>>k;
    rep(i,k){
        cin>>D[i]>>L[i];
    }
    dp[0][0]=1;
    rep(i,k){
        int s=mint(10).pow(L[i]).val(),t=(((mint(10).pow(L[i])-1)/9)*D[i]).val();
        rep(j,7){
            dp[i+1][j]+=dp[i][j];
            dp[i+1][(j*s+t)%7]+=dp[i][j];
        }
        rep(j,7){
            dp[i+1][j]%=MOD;
        }
    }
    ll ans=0;
    rep(i,7){
        ans+=i*dp[k][i];
        ans%=MOD;
    }
    cout<<ans<<"\n";
}
0