結果

問題 No.1292 パタパタ三角形
ユーザー 👑 H20H20
提出日時 2020-11-20 22:57:34
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 185 ms / 2,000 ms
コード長 1,378 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 86,692 KB
実行使用メモリ 122,988 KB
最終ジャッジ日時 2023-09-30 19:49:10
合計ジャッジ時間 3,278 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,232 KB
testcase_01 AC 74 ms
71,268 KB
testcase_02 AC 74 ms
71,052 KB
testcase_03 AC 73 ms
71,396 KB
testcase_04 AC 72 ms
71,164 KB
testcase_05 AC 74 ms
71,312 KB
testcase_06 AC 74 ms
71,216 KB
testcase_07 AC 161 ms
96,704 KB
testcase_08 AC 160 ms
96,360 KB
testcase_09 AC 185 ms
122,988 KB
testcase_10 AC 183 ms
122,980 KB
testcase_11 AC 185 ms
122,840 KB
testcase_12 AC 154 ms
115,148 KB
testcase_13 AC 158 ms
114,796 KB
testcase_14 AC 107 ms
90,540 KB
testcase_15 AC 107 ms
90,812 KB
testcase_16 AC 109 ms
90,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
x = 0 
y = 0
pattern = 0
LIST = [(0,0)]
for i in range(len(S)):
    if pattern==0:
        if S[i]=='a':
            y -= 1
            pattern=3
        if S[i]=='b':
            x -= 1
            pattern=1
        if S[i]=='c':
            x += 1
            pattern=5
    elif pattern==1:
        if S[i]=='a':
            x -= 1
            pattern=4
        if S[i]=='b':
            x += 1
            pattern=0
        if S[i]=='c':
            y += 1
            pattern=2
    elif pattern==2:
        if S[i]=='a':
            x -= 1
            pattern=5
        if S[i]=='b':
            x += 1
            pattern=3
        if S[i]=='c':
            y -= 1
            pattern=1
    elif pattern==3:
        if S[i]=='a':
            y += 1
            pattern=0
        if S[i]=='b':
            x -= 1
            pattern=2
        if S[i]=='c':
            x += 1
            pattern=4
    elif pattern==4:
        if S[i]=='a':
            x += 1
            pattern=1
        if S[i]=='b':
            y -= 1
            pattern=5
        if S[i]=='c':
            x -= 1
            pattern=3
    elif pattern==5:
        if S[i]=='a':
            x += 1
            pattern=2
        if S[i]=='b':
            y += 1
            pattern=4
        if S[i]=='c':
            x -= 1
            pattern=0
    LIST.append((y,x))
print(len(set(LIST)))
0