結果

問題 No.1629 Sorting Integers (SUM of M)
ユーザー lasjg72lasjg72
提出日時 2021-07-31 05:25:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 851 bytes
コンパイル時間 4,757 ms
コンパイル使用メモリ 91,480 KB
実行使用メモリ 5,292 KB
最終ジャッジ日時 2023-10-14 14:30:07
合計ジャッジ時間 2,178 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <cassert>

using namespace std;
using ll = long long;
const int mod = 1e9+7;

int main()
{
    int n;
    cin >> n;
    vector<int> a;
    map<int, int> mp;
    for(int i = 0; i < 9; i++){
        cin >> mp[i+1];
        if(mp[i+1] > 0) a.push_back(i+1);
    }
    ll ans = 0, tmp = 1;
    ll num = 1;
    for(int i = a.size()-1; i >= 1; i--) num *= i;
    for(int i = 0; i < n; i++){
        //cout << "----" << tmp << "----" << endl;
        for(int j : a){
            //cout << "j: " << j << " num[j]: " << mp[j] << endl;
            ans = ans+((((j*tmp)%mod)*num)%mod)*mp[j]%mod;
            ans %= mod;
        }
        tmp *= 10;
    }
    cout << ans << endl;
    return 0;
}
0