結果
問題 |
No.1740 Alone 'a'
|
ユーザー |
![]() |
提出日時 | 2025-06-16 20:00:58 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 218 ms / 2,000 ms |
コード長 | 401 bytes |
コンパイル時間 | 431 ms |
コンパイル使用メモリ | 82,220 KB |
実行使用メモリ | 73,356 KB |
最終ジャッジ日時 | 2025-06-16 20:01:03 |
合計ジャッジ時間 | 4,618 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
MOD = 998244353 N = int(input()) S = input() ans = 0 f = True for i,s in enumerate(S): if s == "a": if f: f = False continue else: break a = ord(s) - 97 if f: ans += pow(25, N - i - 1, MOD) ans += (a - 1) * (N - i - 1) * pow(25, N - i - 2, MOD) else: ans += (a-1) * pow(25,N-i-1,MOD) ans%= MOD print(ans)