fork download
  1. def parse(inFile):
  2. return inFile.getInts()[1:]
  3.  
  4. def solve(scores):
  5. points = [z for z in scores]
  6. total = float(sum(points))
  7. N = len(points)
  8. qual = (2 * total) / N
  9. alreadyqual = 0
  10. while (len([score for score in points if score > qual]) > 0):
  11. qs = [score for score in points if score > qual]
  12. alreadyqual += sum(qs)
  13. points = [score for score in points if score <= qual]
  14. N = len(points)
  15. qual = (2 * total - alreadyqual) / N
  16. return " ".join(["%.6f" % (((qual - score) * 100 / total) if (qual > score) else 0) for score in scores])
  17.  
  18. if __name__ == "__main__":
  19. from GCJ import GCJ
  20. GCJ(parse, solve, "/Users/lpebody/gcj/2012_1b/", "a").run()
  21.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty