結果

問題 No.1292 パタパタ三角形
ユーザー Kite_kumaKite_kuma
提出日時 2020-11-20 21:56:38
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 164 ms / 2,000 ms
コード長 601 bytes
コンパイル時間 338 ms
コンパイル使用メモリ 87,148 KB
実行使用メモリ 109,112 KB
最終ジャッジ日時 2023-09-30 19:11:27
合計ジャッジ時間 3,118 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,104 KB
testcase_01 AC 72 ms
70,944 KB
testcase_02 AC 72 ms
70,908 KB
testcase_03 AC 72 ms
71,336 KB
testcase_04 AC 74 ms
71,104 KB
testcase_05 AC 73 ms
71,016 KB
testcase_06 AC 76 ms
71,172 KB
testcase_07 AC 144 ms
82,424 KB
testcase_08 AC 133 ms
81,888 KB
testcase_09 AC 161 ms
108,644 KB
testcase_10 AC 164 ms
109,112 KB
testcase_11 AC 162 ms
108,924 KB
testcase_12 AC 141 ms
98,072 KB
testcase_13 AC 146 ms
104,184 KB
testcase_14 AC 93 ms
76,628 KB
testcase_15 AC 92 ms
76,500 KB
testcase_16 AC 93 ms
76,480 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