結果
問題 |
No.1740 Alone 'a'
|
ユーザー |
|
提出日時 | 2021-11-12 22:48:48 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 545 bytes |
コンパイル時間 | 191 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 70,272 KB |
最終ジャッジ日時 | 2024-11-25 20:36:09 |
合計ジャッジ時間 | 4,662 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 WA * 33 |
ソースコード
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)