結果

問題 No.1292 パタパタ三角形
ユーザー persimmon-persimmonpersimmon-persimmon
提出日時 2021-02-15 20:22:53
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 744 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 99,088 KB
最終ジャッジ日時 2023-09-30 18:35:26
合計ジャッジ時間 3,526 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,492 KB
testcase_01 AC 71 ms
71,512 KB
testcase_02 AC 71 ms
71,468 KB
testcase_03 AC 71 ms
71,284 KB
testcase_04 AC 75 ms
71,268 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 155 ms
98,960 KB
testcase_13 AC 159 ms
99,088 KB
testcase_14 AC 101 ms
77,152 KB
testcase_15 AC 94 ms
76,860 KB
testcase_16 AC 93 ms
76,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s=input()
# 正三角形を直角二等辺三角形にする。
# 三点x,y,z=(0,0),(1,0),(0,1)
# a=yz,b=xy,c=xzとする
# 三点の合計ベクトルと三角形の位置は一対一に対応する
x,y,z=[0,0],[1,0],[0,1]
seen={(1,1)}
for si in s:
  if si=='a':
    # y,zはそのまま。xが動く。
    # yzは斜線
    if y[0]==x[0]:
      x=[z[0],y[1]]
    else:
      x=[y[0],z[1]]
  elif si=='b':
    # x,yはそのまま。zが動く。
    if z[0]==x[0]:
      z=[z[0],2*x[1]-z[1]]
    else:
      z=[2*x[0]-z[0],z[1]]
  else:
    # x,zはそのまま。yが動く。
    if y[0]==x[0]:
      y=[y[0],2*x[1]-y[1]]
    else:
      y=[2*x[0]-y[0],y[1]]
  v0=x[0]+y[0]+z[0]
  v1=x[1]+y[1]+z[1]
  seen.add((v0,v1))

print(len(seen))


0