結果

問題 No.1292 パタパタ三角形
ユーザー Kite_kumaKite_kuma
提出日時 2020-11-20 21:56:38
言語 PyPy3
(7.9.16)
結果
AC  
実行時間 241 ms / 2,000 ms
コード長 601 bytes
コンパイル時間 224 ms
実行使用メモリ 110,000 KB
最終ジャッジ日時 2023-02-23 18:16:15
合計ジャッジ時間 3,420 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
75,764 KB
testcase_01 AC 73 ms
75,480 KB
testcase_02 AC 74 ms
75,752 KB
testcase_03 AC 72 ms
75,732 KB
testcase_04 AC 71 ms
75,756 KB
testcase_05 AC 71 ms
75,776 KB
testcase_06 AC 71 ms
75,528 KB
testcase_07 AC 227 ms
87,660 KB
testcase_08 AC 185 ms
87,448 KB
testcase_09 AC 211 ms
101,740 KB
testcase_10 AC 241 ms
107,072 KB
testcase_11 AC 223 ms
107,480 KB
testcase_12 AC 128 ms
104,092 KB
testcase_13 AC 134 ms
110,000 KB
testcase_14 AC 96 ms
81,452 KB
testcase_15 AC 93 ms
81,268 KB
testcase_16 AC 91 ms
81,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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))
0