結果

問題 No.1620 Substring Sum
ユーザー Noela3141592Noela3141592
提出日時 2021-09-19 17:02:44
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 1,193 bytes
コンパイル時間 1,474 ms
コンパイル使用メモリ 164,992 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-14 13:03:58
合計ジャッジ時間 2,989 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 22 ms
4,376 KB
testcase_05 AC 22 ms
4,376 KB
testcase_06 AC 22 ms
4,380 KB
testcase_07 AC 22 ms
4,376 KB
testcase_08 AC 22 ms
4,380 KB
testcase_09 AC 21 ms
4,380 KB
testcase_10 AC 22 ms
4,380 KB
testcase_11 AC 22 ms
4,376 KB
testcase_12 AC 8 ms
4,380 KB
testcase_13 AC 20 ms
4,380 KB
testcase_14 AC 21 ms
4,380 KB
testcase_15 AC 18 ms
4,376 KB
testcase_16 AC 13 ms
4,376 KB
testcase_17 AC 17 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 22 ms
4,380 KB
testcase_21 AC 22 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
// using mint = modint1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i,n) for(int i=1;i<=(int)(n);i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using ll = long long;
typedef pair<int, int> P;
#define EPS (1e-12)
const int MOD=998244353;
// const int vx[]={0,1,0,-1},vy[]={1,0,-1,0};
template<class T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<class T>T lcm(T a,T b){return a*b/gcd(a,b);}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

//a^t(mod m)  O(log t)
ll mpow(ll a,ll t,ll m){
    ll rec=1;
    while(t>0){
        if(t&1){
            rec=rec*a%m;
        }
        a=a*a%m;
        t>>=1;
    }
    return rec;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s;
    cin>>s;
    ll ans=0;
    rep(i,s.size()){
        ll now=s[i]-'0';
        ans=ans*10+mpow(2,i,MOD)*now+ans;
        ans%=MOD;
        // cout<<ans<<'\n';
    }
    cout<<ans<<endl;
}
0