You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4 년 전
123456789101112131415
  1. import sys
  2. def march(text):
  3. base = '.' + text + '.'
  4. for i in range(len(text)):
  5. yield '.^'[base[i:i + 3] in {'^^.', '.^^', '^..', '..^'}]
  6. text = sys.stdin.read().strip()
  7. seen = [text]
  8. for i in range(400_000):
  9. seen.append(''.join(march(seen[-1])))
  10. print(''.join(seen[:40]).count('.'))
  11. print(''.join(seen[:400_000]).count('.'))