結果
| 問題 | No.1292 パタパタ三角形 | 
| コンテスト | |
| ユーザー |  Kite_kuma | 
| 提出日時 | 2020-11-20 21:56:38 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 124 ms / 2,000 ms | 
| コード長 | 601 bytes | 
| コンパイル時間 | 152 ms | 
| コンパイル使用メモリ | 82,112 KB | 
| 実行使用メモリ | 107,472 KB | 
| 最終ジャッジ日時 | 2024-07-23 12:56:28 | 
| 合計ジャッジ時間 | 2,039 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 14 | 
ソースコード
s = input()
x = 0
y = 0
cnt = 0
se = set()
se.add((0, 0))
for c in s:
    t = 0
    if c == 'b':
        t = 1
    elif c == 'c':
        t = 2
    # if cnt % 2 == 0:
    now = -x + 2 * t
    now %= 3
    if now == 0:
        if cnt % 2 == 0:
            y -= 1
        else:
            y += 1
    if now == 2:
        x += 1
    if now == 1:
        x -= 1
    # # else:
    #     now = t * 2-x
    #     now %= 3
    #     if now == 0:
    #         y += 1
    #     if now == 1:
    #         x += 1
    #     if now == 2:
    #         x -= 1
    se.add((x, y))
    cnt += 1
print(len(se))
            
            
            
        