您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

41 行
842B

  1. import collections
  2. import itertools
  3. import re
  4. import sys
  5. import toolkit
  6. Node = collections.namedtuple('Node', 'x, y, size, used, avail, pc')
  7. nodes = []
  8. text = sys.stdin.read()
  9. for line in text.splitlines():
  10. found = list(map(int, re.findall(r'\d+', line)))
  11. if found:
  12. nodes.append(Node(*found))
  13. ans1 = 0
  14. for a, b in itertools.permutations(nodes, 2):
  15. if a.used and a.used <= b.avail:
  16. ans1 += 1
  17. print(ans1)
  18. def glyph(node):
  19. if node.used == 0:
  20. return '_'
  21. elif node.x == 0 and node.y == 0:
  22. return '^'
  23. elif node.x == 29 and node.y == 0:
  24. return '@'
  25. elif node.used > 100:
  26. return '#'
  27. elif node.size > 70:
  28. return '.'
  29. else:
  30. return ' '
  31. print(toolkit.render({complex(node.x, node.y): glyph(node) for node in nodes}))
  32. print(5 + 33 + 6 + 5 * 28 + 1)