結果

問題 No.2021 Not A but B
ユーザー 👑 H20H20
提出日時 2022-07-29 22:11:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 297 ms / 2,000 ms
コード長 292 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 87,016 KB
実行使用メモリ 115,788 KB
最終ジャッジ日時 2023-09-26 21:15:27
合計ジャッジ時間 6,999 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,476 KB
testcase_01 AC 76 ms
71,188 KB
testcase_02 AC 74 ms
71,280 KB
testcase_03 AC 74 ms
71,516 KB
testcase_04 AC 73 ms
71,180 KB
testcase_05 AC 71 ms
71,516 KB
testcase_06 AC 72 ms
71,284 KB
testcase_07 AC 74 ms
71,044 KB
testcase_08 AC 258 ms
102,972 KB
testcase_09 AC 258 ms
102,900 KB
testcase_10 AC 256 ms
102,768 KB
testcase_11 AC 250 ms
102,768 KB
testcase_12 AC 253 ms
102,812 KB
testcase_13 AC 251 ms
102,688 KB
testcase_14 AC 254 ms
102,776 KB
testcase_15 AC 251 ms
102,816 KB
testcase_16 AC 248 ms
102,656 KB
testcase_17 AC 249 ms
102,676 KB
testcase_18 AC 257 ms
102,972 KB
testcase_19 AC 260 ms
103,028 KB
testcase_20 AC 258 ms
103,072 KB
testcase_21 AC 91 ms
75,968 KB
testcase_22 AC 90 ms
76,292 KB
testcase_23 AC 87 ms
76,296 KB
testcase_24 AC 82 ms
76,168 KB
testcase_25 AC 89 ms
76,176 KB
testcase_26 AC 175 ms
79,748 KB
testcase_27 AC 279 ms
115,788 KB
testcase_28 AC 276 ms
115,552 KB
testcase_29 AC 297 ms
110,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = list(input())
mod = 10**9+9
v = 0
for i,s in enumerate(S):
    if s=='B':
        v+=pow(2,i,mod)
ANS = set()
for i in range(N-1):
    temp = v
    if S[i]=='A':
        temp+=pow(2,i,mod)
    if S[i+1]=='A':
        temp+=pow(2,i+1,mod)
    ANS.add(temp)
print(len(ANS))
0