公式

A - Rock-paper-scissors 解説 by en_translator


Three hands \(x,y,z\) result in draw if and only if \(x+y+z \equiv 0 \bmod 3\) (which can be easily understood by drawing a tree diagram of all possibilities).

Therefore, one can obtain AC more easily by outputting \((6-x-y)\%3\).

Sample code (Python)

x,y = map(int,input().split())
print((6-x-y)%3)

投稿日時:
最終更新: