結果
| 問題 |
No.1646 Avoid Palindrome
|
| コンテスト | |
| ユーザー |
taiga0629kyopro
|
| 提出日時 | 2021-08-13 21:42:45 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 362 bytes |
| コンパイル時間 | 178 ms |
| コンパイル使用メモリ | 82,608 KB |
| 実行使用メモリ | 67,360 KB |
| 最終ジャッジ日時 | 2024-10-03 18:05:15 |
| 合計ジャッジ時間 | 3,806 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 9 WA * 31 |
ソースコード
n=int(input())
s=["#"]+list(input())+["?","?"]
ans=1
mod=998244353
for i in range(1,n+1):
if s[i]=="?":
cnt=26
if i>=2:cnt-=1
if i>=3:cnt-=1
if s[i+1]!="?":cnt-=1
if s[i+2]!="?":cnt-=1
ans*=cnt
ans%=mod
else:
if i>=2 and s[i]==s[i-1]:ans=0
if i>=3 and s[i]==s[i-2]:ans=0
print(ans)
taiga0629kyopro