結果

問題 No.1740 Alone 'a'
ユーザー prussian_coderprussian_coder
提出日時 2022-03-23 22:18:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 66 ms / 2,000 ms
コード長 342 bytes
コンパイル時間 526 ms
コンパイル使用メモリ 82,516 KB
実行使用メモリ 76,368 KB
最終ジャッジ日時 2024-04-20 06:20:12
合計ジャッジ時間 3,921 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,428 KB
testcase_01 AC 34 ms
52,688 KB
testcase_02 AC 35 ms
53,352 KB
testcase_03 AC 61 ms
76,088 KB
testcase_04 AC 59 ms
76,052 KB
testcase_05 AC 48 ms
63,592 KB
testcase_06 AC 51 ms
64,624 KB
testcase_07 AC 40 ms
54,100 KB
testcase_08 AC 37 ms
52,736 KB
testcase_09 AC 37 ms
53,028 KB
testcase_10 AC 35 ms
53,008 KB
testcase_11 AC 54 ms
73,616 KB
testcase_12 AC 64 ms
76,068 KB
testcase_13 AC 59 ms
76,024 KB
testcase_14 AC 61 ms
76,092 KB
testcase_15 AC 47 ms
60,856 KB
testcase_16 AC 56 ms
75,924 KB
testcase_17 AC 41 ms
61,348 KB
testcase_18 AC 45 ms
68,936 KB
testcase_19 AC 57 ms
75,996 KB
testcase_20 AC 53 ms
75,780 KB
testcase_21 AC 56 ms
76,056 KB
testcase_22 AC 54 ms
76,216 KB
testcase_23 AC 56 ms
76,368 KB
testcase_24 AC 59 ms
75,796 KB
testcase_25 AC 63 ms
75,924 KB
testcase_26 AC 62 ms
75,768 KB
testcase_27 AC 66 ms
76,040 KB
testcase_28 AC 64 ms
75,936 KB
testcase_29 AC 63 ms
75,880 KB
testcase_30 AC 65 ms
75,780 KB
testcase_31 AC 65 ms
76,144 KB
testcase_32 AC 55 ms
75,664 KB
testcase_33 AC 55 ms
76,156 KB
testcase_34 AC 44 ms
70,800 KB
testcase_35 AC 52 ms
75,768 KB
testcase_36 AC 53 ms
75,884 KB
testcase_37 AC 44 ms
70,476 KB
testcase_38 AC 50 ms
75,936 KB
testcase_39 AC 43 ms
64,384 KB
testcase_40 AC 50 ms
75,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
S=input()
mod=998244353
A=[0,0]
B=[1,0]
for i in range(N):
	AA=A.copy()
	BB=B.copy()
	A= [0,0]
	B= [0,0]
	A[1] += AA[1]*25 + AA[0]
	A[0] += AA[0]*25
	if S[i]!="a":
		A[1] += BB[1]*(ord(S[i])-98) + BB[0]
		A[0] += BB[0]*(ord(S[i])-98)
		B[1] += BB[1]
		B[0] += BB[0]
	else:
		B[1]+=BB[0]
	A[0]%=mod
	A[1]%=mod

		
		
print(A[1])
0