結果
| 問題 | No.1620 Substring Sum |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-01-24 17:30:37 |
| 言語 | C11(gcc12 gnu拡張) (gcc 12.4.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 484 bytes |
| 記録 | |
| コンパイル時間 | 114 ms |
| コンパイル使用メモリ | 32,444 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-03-08 16:32:34 |
| 合計ジャッジ時間 | 878 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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’
main.c:11:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%s", cc);
| ^~~~~~~~~~~~~~~
ソースコード
// 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;
}