Loading... ![P1223 排队接水][1] n = int(input()) list1 = list(map(int, input().split())) c = 1 sum1 = 0 list2 = [] for i in range(n): list2.append({"id": i + 1, "time": list1[i]}) list2.sort(key=lambda rank: rank["time"]) for i in list2: sum1 += i["time"] * (n - c) c += 1 for i in range(n): if i == n - 1: print(list2[i]["id"], end="") else: print(list2[i]["id"], end=" ") print() print("%.2f" % (sum1/n)) [1]: https://i.loli.net/2021/06/02/kzh7MsgTyiPWaUK.png Last modification:June 2, 2021 © Allow specification reprint Like 0 如果觉得我的文章对你有用,请随意赞赏
Comment here is closed