結果
問題 | No.1740 Alone 'a' |
ユーザー | horitaka1999 |
提出日時 | 2021-11-12 22:48:48 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 545 bytes |
コンパイル時間 | 410 ms |
コンパイル使用メモリ | 87,068 KB |
実行使用メモリ | 80,104 KB |
最終ジャッジ日時 | 2023-08-17 03:08:50 |
合計ジャッジ時間 | 6,881 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 68 ms
71,244 KB |
testcase_01 | AC | 69 ms
71,532 KB |
testcase_02 | AC | 69 ms
71,404 KB |
testcase_03 | AC | 254 ms
80,044 KB |
testcase_04 | AC | 252 ms
80,104 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 68 ms
71,372 KB |
testcase_09 | AC | 70 ms
71,464 KB |
testcase_10 | AC | 70 ms
71,332 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
ソースコード
N = int(input()) S = list(input()) store = set() ans = 0 mod = 998244353 def change(s): return ord(s) - ord('a') + 1 for i in range(N): store.add(S[i]) if 'a' in store: tmp = (change(S[i]) -2) * pow(25,N-1-i,mod) if tmp > 0: ans += tmp ans %= mod else: if N -1 - i > 0: tmp = (change(S[i]) -2) * pow(25,N-1-i-1,mod) * (N-1-i) if tmp > 0: ans += tmp ans %= mod ans += pow(25,N-1-i,mod) ans %= mod print(ans)