#32545: python 的解法


birds.dai@gmail.com (Shao-Ting Dai)


雖用到%但卻不是用來找3的倍數,這樣對限制條件來說是許可的嗎?
 
b=[]
c=[]
while True:
  try:
    b.clear()
    c.clear()
    a=int(input())
    while a>0:
      b.append(a%10)
      a=a//10
    for i in range(0,16):
      c.append(3*i)
    if sum(b) in c:
      print("YES")
    else:
      print("NO")
  except EOFError:
    break