結果
問題 |
No.1171 Runs in Subsequences
|
ユーザー |
|
提出日時 | 2020-08-15 16:24:01 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 293 ms / 2,000 ms |
コード長 | 276 bytes |
コンパイル時間 | 337 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 60,032 KB |
最終ジャッジ日時 | 2024-10-10 18:10:16 |
合計ジャッジ時間 | 3,982 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 18 |
ソースコード
import sys input = sys.stdin.readline S = input()[:-1] N = len(S) sub = [0]*26 ans = 0 MOD = 10**9+7 for i in range(N): j = ord(S[i])-ord('a') ans += (pow(2, i, MOD)-sub[j])*pow(2, N-1-i, MOD) ans %= MOD sub[j] += pow(2, i, MOD) sub[j] %= MOD print(ans)