結果
| 問題 |
No.1620 Substring Sum
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-01-24 17:30:37 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 484 bytes |
| コンパイル時間 | 537 ms |
| コンパイル使用メモリ | 29,440 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-26 04:58:06 |
| 合計ジャッジ時間 | 1,820 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 |
コンパイルメッセージ
main.c: In function 'main':
main.c:12:13: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
12 | n = strlen(cc);
| ^~~~~~
main.c:3:1: note: include '<string.h>' or provide a declaration of 'strlen'
2 | #include <stdio.h>
+++ |+#include <string.h>
3 | #define S 200000+2
main.c:12:13: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
12 | n = strlen(cc);
| ^~~~~~
main.c:12:13: note: include '<string.h>' or provide a declaration of 'strlen'
ソースコード
// coached by https://www.luogu.com.cn/problem/P6146
#include <stdio.h>
#define S 200000+2
#define MD 998244353
int main() {
static char cc[S];
static int dd[S], bb[S];
int n, h;
scanf("%s", cc);
n = strlen(cc);
bb[0] = 1;
for (h = 1; h < n; h++)
bb[h] = bb[h - 1] * 2ll % MD;
for (h = 0; h < n; h++) {
if (h)
dd[h] = (0ll + dd[h - 1] + dd[h - 1] * 10ll + 1ll * bb[h] * (cc[h] - '0')) % MD;
else
dd[h] = cc[h] - '0';
}
printf("%d\n", dd[n - 1]);
return 0;
}