結果

問題 No.1292 パタパタ三角形
ユーザー tsuzuiritsuzuiri
提出日時 2020-11-25 23:59:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,134 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 86,996 KB
実行使用メモリ 120,252 KB
最終ジャッジ日時 2023-10-01 02:03:04
合計ジャッジ時間 5,102 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def p2(data):
    inputs=list(data)
    ref = 0
    x=0
    y=0
    inv=0
    history = set()
    history.add((x,y))
    for _in in inputs:
        if 0==ref:
            if _in == 'a':
                if inv:
                    y+=1
                else:
                    y-=1
            elif _in == 'b':
                x+=1
                ref=2
            else:
                x-=1
                ref=1
        elif 1==ref:
            if _in == 'b':
                if inv:
                    y+=1
                else:
                    y-=1
            elif _in == 'c':
                x+=1
                ref=0
            else:
                x-=1
                ref=2
        else:
            if _in == 'c':
                if inv:
                    y+=1
                else:
                    y-=1
            elif _in == 'a':
                x+=1
                ref=1
            else:
                x-=1
                ref=0
        history.add((x,y))
        inv^=1
        print(ref,' ',x,' ', y)
    print(len(history))


from sys import stdin
input = stdin.readline

p2(list(input().rstrip()))
0