結果
問題 | No.1620 Substring Sum |
ユーザー |
|
提出日時 | 2024-11-10 18:53:37 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 9 ms / 2,000 ms |
コード長 | 545 bytes |
コンパイル時間 | 6,119 ms |
コンパイル使用メモリ | 309,184 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-11-10 18:53:44 |
合計ジャッジ時間 | 6,755 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace atcoder; #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using mint = modint998244353; int main() { string s; cin >> s; int n = s.size(); vector<mint> pow2(n), pow11(n); pow2[0] = 1, pow11[0] = 1; rep(i, n) { pow2[i+1] = pow2[i]*2; pow11[i+1] = pow11[i]*11; } mint ans; rep(i, n) { ans += pow2[i] * pow11[n-1-i] * (s[i]-'0'); } cout << ans.val() << '\n'; return 0; }