結果

問題 No.1292 パタパタ三角形
ユーザー とりゐとりゐ
提出日時 2021-10-27 09:13:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 615 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 82,356 KB
実行使用メモリ 112,208 KB
最終ジャッジ日時 2024-04-16 11:41:41
合計ジャッジ時間 2,184 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,224 KB
testcase_01 AC 38 ms
52,352 KB
testcase_02 AC 39 ms
52,096 KB
testcase_03 AC 39 ms
52,096 KB
testcase_04 AC 35 ms
51,712 KB
testcase_05 AC 36 ms
52,096 KB
testcase_06 AC 36 ms
52,352 KB
testcase_07 AC 118 ms
82,020 KB
testcase_08 AC 114 ms
81,444 KB
testcase_09 AC 143 ms
107,708 KB
testcase_10 AC 149 ms
112,132 KB
testcase_11 AC 149 ms
112,208 KB
testcase_12 AC 113 ms
101,060 KB
testcase_13 AC 112 ms
101,212 KB
testcase_14 AC 54 ms
65,152 KB
testcase_15 AC 54 ms
65,536 KB
testcase_16 AC 56 ms
65,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s=input()
seen=set()
x,y=0,0
seen.add((0,0))
n=len(s)
for i in s:
  if (x%3,y%3)==(0,0):
    if i=='a':x+=1
    elif i=='b':y+=1
    else:x-=1;y-=1
  elif (x%3,y%3)==(1,0):
    if i=='a':x-=1
    elif i=='b':x+=1;y+=1
    else:y-=1
  elif (x%3,y%3)==(2,1):
    if i=='a':y+=1
    elif i=='b':x-=1;y-=1
    else:x+=1
  elif (x%3,y%3)==(2,2):
    if i=='a':y-=1
    elif i=='b':x-=1
    else:x+=1;y+=1
  elif (x%3,y%3)==(1,2):
    if i=='a':x-=1;y-=1
    elif i=='b':x+=1
    else:y+=1
  elif (x%3,y%3)==(0,1):
    if i=='a':x+=1;y+=1
    elif i=='b':y-=1
    else:x-=1
  seen.add((x,y))
print(len(seen))
#print(seen)
0