結果
| 問題 |
No.1620 Substring Sum
|
| コンテスト | |
| ユーザー |
monnu
|
| 提出日時 | 2021-07-23 07:13:45 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 41 ms / 2,000 ms |
| コード長 | 588 bytes |
| コンパイル時間 | 3,719 ms |
| コンパイル使用メモリ | 230,728 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-18 03:57:20 |
| 合計ジャッジ時間 | 4,754 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll=long long;
using Graph=vector<vector<pair<int,int>>>;
#define MAX 100
#define MOD 998244353
#define INF 1000000000
ll modpow(ll a,ll n){
a%=MOD;
ll ret=1;
while(n>0){
if((n&1)==1){
ret=ret*a%MOD;
}
n>>=1;
a=a*a%MOD;
}
return ret;
}
int main(){
string S;
cin>>S;
int N=S.size();
ll ans=0;
for(int i=0;i<N;i++){
ll x=(ll)(S[i]-'0');
x=x*modpow(11,N-1-i)%MOD;
x=x*modpow(2,i)%MOD;
ans+=x;
ans%=MOD;
}
cout<<ans<<endl;
}
monnu