結果
| 問題 | No.1292 パタパタ三角形 | 
| コンテスト | |
| ユーザー |  とりゐ | 
| 提出日時 | 2021-10-27 09:13:46 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 146 ms / 2,000 ms | 
| コード長 | 615 bytes | 
| コンパイル時間 | 615 ms | 
| コンパイル使用メモリ | 81,924 KB | 
| 実行使用メモリ | 111,860 KB | 
| 最終ジャッジ日時 | 2024-10-07 05:35:08 | 
| 合計ジャッジ時間 | 2,628 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 14 | 
ソースコード
s=input()
seen=set()
x,y=0,0
seen.add((0,0))
n=len(s)
for i in s:
  if (x%3,y%3)==(0,0):
    if i=='a':x+=1
    elif i=='b':y+=1
    else:x-=1;y-=1
  elif (x%3,y%3)==(1,0):
    if i=='a':x-=1
    elif i=='b':x+=1;y+=1
    else:y-=1
  elif (x%3,y%3)==(2,1):
    if i=='a':y+=1
    elif i=='b':x-=1;y-=1
    else:x+=1
  elif (x%3,y%3)==(2,2):
    if i=='a':y-=1
    elif i=='b':x-=1
    else:x+=1;y+=1
  elif (x%3,y%3)==(1,2):
    if i=='a':x-=1;y-=1
    elif i=='b':x+=1
    else:y+=1
  elif (x%3,y%3)==(0,1):
    if i=='a':x+=1;y+=1
    elif i=='b':y-=1
    else:x-=1
  seen.add((x,y))
print(len(seen))
#print(seen)
            
            
            
        