fork download
  1.  
  2. s = """
  3. Nexus 1
  4. Probe 1
  5. Zealot 2
  6. Sentry 2
  7. Stalker 2
  8. HighTemplar 2
  9. DarkTemplar 2
  10. Immortal 4
  11. Colossus 6
  12. Archon 4
  13. Observer 1
  14. WarpPrism 2
  15. Phoenix 2
  16. MothershipCore 2
  17. VoidRay 4
  18. Oracle 3
  19. Tempest 4
  20. Carrier 6
  21. Mothership 8
  22. """.strip()
  23.  
  24. d = dict(line.split() for line in s.splitlines())
  25. d = {k: int(v) for k,v in d.items()}
  26.  
  27. for key in d:
  28. l = [key]
  29. result = sum((('vexuobcl'+2*'clsuie'+4*'Ratahoiesuhihi').count(q[-3:-1])*(1-12*(q[0]=="N"))or 2)for q in l)
  30. assert result == d[key] or (key == "Nexus" and result == -11)
  31. print(key, d[key], result)
  32.  
  33.  
Success #stdin #stdout 0.02s 9936KB
stdin
Standard input is empty
stdout
DarkTemplar 2 2
Mothership 8 8
Immortal 4 4
Phoenix 2 2
Sentry 2 2
Archon 4 4
HighTemplar 2 2
Observer 1 1
WarpPrism 2 2
Tempest 4 4
Zealot 2 2
Colossus 6 6
MothershipCore 2 2
Stalker 2 2
Nexus 1 -11
Oracle 3 3
Carrier 6 6
Probe 1 1
VoidRay 4 4