結果

問題 No.1620 Substring Sum
ユーザー KudeKude
提出日時 2021-07-22 22:09:31
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 958 bytes
コンパイル時間 4,406 ms
コンパイル使用メモリ 259,940 KB
実行使用メモリ 5,244 KB
最終ジャッジ日時 2023-09-24 17:12:22
合計ジャッジ時間 5,217 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
5,184 KB
testcase_01 AC 4 ms
5,188 KB
testcase_02 AC 3 ms
4,964 KB
testcase_03 AC 4 ms
4,960 KB
testcase_04 AC 5 ms
5,076 KB
testcase_05 AC 5 ms
5,176 KB
testcase_06 AC 5 ms
5,132 KB
testcase_07 AC 4 ms
5,180 KB
testcase_08 AC 5 ms
5,080 KB
testcase_09 AC 5 ms
5,144 KB
testcase_10 AC 5 ms
5,184 KB
testcase_11 AC 5 ms
5,048 KB
testcase_12 AC 4 ms
5,100 KB
testcase_13 AC 5 ms
5,168 KB
testcase_14 AC 5 ms
5,092 KB
testcase_15 AC 4 ms
5,244 KB
testcase_16 AC 5 ms
5,076 KB
testcase_17 AC 5 ms
5,208 KB
testcase_18 AC 4 ms
4,964 KB
testcase_19 AC 4 ms
5,016 KB
testcase_20 AC 5 ms
5,052 KB
testcase_21 AC 5 ms
5,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i,n)for (int i = 0; i < int(n); ++i)
#define rrep(i,n)for (int i = int(n)-1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
template<class T> void chmax(T& a, const T& b) {a = max(a, b);}
template<class T> void chmin(T& a, const T& b) {a = min(a, b);}
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using mint = modint998244353;

constexpr int MX = 200010;
mint pow2[MX], pow11[MX];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    pow2[0] = pow11[0] = 1;
    rep(i, MX - 1) pow2[i + 1] = pow2[i] * 2, pow11[i + 1] = pow11[i] * 11;
    mint ans = 0;
    string s;
    cin >> s;
    int n = s.size();
    rep(i, n) ans += (s[i] - '0') * pow2[i] * pow11[n - 1 - i];
    cout << ans.val() << endl;
}
0