結果

問題 No.1292 パタパタ三角形
ユーザー H20H20
提出日時 2020-11-20 22:57:34
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 176 ms / 2,000 ms
コード長 1,378 bytes
コンパイル時間 290 ms
使用メモリ 127,840 KB
最終ジャッジ日時 2023-02-23 19:18:42
合計ジャッジ時間 3,903 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 76 ms
75,508 KB
testcase_01 AC 74 ms
75,444 KB
testcase_02 AC 74 ms
75,796 KB
testcase_03 AC 74 ms
75,736 KB
testcase_04 AC 73 ms
75,448 KB
testcase_05 AC 74 ms
75,504 KB
testcase_06 AC 74 ms
75,780 KB
testcase_07 AC 165 ms
101,108 KB
testcase_08 AC 169 ms
100,896 KB
testcase_09 AC 176 ms
127,704 KB
testcase_10 AC 174 ms
127,684 KB
testcase_11 AC 174 ms
127,840 KB
testcase_12 AC 152 ms
121,308 KB
testcase_13 AC 161 ms
119,664 KB
testcase_14 AC 113 ms
95,108 KB
testcase_15 AC 110 ms
95,380 KB
testcase_16 AC 109 ms
95,048 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