結果

問題 No.1620 Substring Sum
ユーザー m0use im0use i
提出日時 2023-01-24 17:30:37
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 484 bytes
コンパイル時間 856 ms
コンパイル使用メモリ 28,532 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-08 11:41:52
合計ジャッジ時間 2,004 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 0 ms
4,376 KB
testcase_04 AC 5 ms
4,380 KB
testcase_05 AC 5 ms
4,380 KB
testcase_06 AC 5 ms
4,376 KB
testcase_07 AC 5 ms
4,380 KB
testcase_08 AC 5 ms
4,384 KB
testcase_09 AC 5 ms
4,380 KB
testcase_10 AC 5 ms
4,376 KB
testcase_11 AC 5 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 5 ms
4,384 KB
testcase_14 AC 5 ms
4,380 KB
testcase_15 AC 4 ms
4,380 KB
testcase_16 AC 4 ms
4,376 KB
testcase_17 AC 4 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 5 ms
4,376 KB
testcase_21 AC 5 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: 関数 ‘main’ 内:
main.c:12:13: 警告: 関数 ‘strlen’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   12 |         n = strlen(cc);
      |             ^~~~~~
main.c:3:1: 備考: 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: 警告: 組み込み関数 ‘strlen’ の互換性がない暗黙的な宣言です [-Wbuiltin-declaration-mismatch]
   12 |         n = strlen(cc);
      |             ^~~~~~
main.c:12:13: 備考: include ‘<string.h>’ or provide a declaration of ‘strlen’

ソースコード

diff #

// 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;
} 
0