Algorithm/Baekjoon

한수(1065번 문제) Python3 답안

Bonita SY 2020. 2. 9. 20:09
728x90
반응형

문제)

답안)

N = int(input())

def main():
  if (N < 100):
    print(N)
    return

  num_cnt = 99
  for i in range(100, N+1):
    hun = int(i / 100)
    ten = int((i % 100) / 10)
    one = int(i % 10)

    if (hun-ten) == (ten-one):
      num_cnt += 1
  print(num_cnt)

if __name__=="__main__":
  main()
728x90
반응형