結果
| 問題 |
No.3110 Like CPCTF?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-18 21:28:04 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 60 ms / 2,000 ms |
| コード長 | 398 bytes |
| コンパイル時間 | 233 ms |
| コンパイル使用メモリ | 82,688 KB |
| 実行使用メモリ | 69,668 KB |
| 最終ジャッジ日時 | 2025-04-18 21:28:07 |
| 合計ジャッジ時間 | 2,274 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
from collections import*
n=int(input())
s=input()
dp=defaultdict(int)
dp['']=1
for i in range(1,n+1):
c=s[i-1]
for k,v in dp.copy().items():
if k and len(k)<5:
if len(k)==2:
if k[0]==c:
dp[k+c]+=v
else:
if c not in k:
dp[k+c]+=v
elif k=='':
dp[c]+=v
# print(i,dp)
ans=0
for k,v in dp.items():
if len(k)==5:
ans+=v
print(ans)