酷代码 AI
菜单
服务商

明朝朱权时期:张居正与冯保助力,求解大臣权力调整最小代价之谜

```python # 读取输入 n = int(input()) num = list(map(int, input().split())) cost = list(map(int, input().split())) # 将num和cost按照num的大小排序 pairs = sorted(zip(num, cost)) num_sorted, cost_sorted = zip(*pairs) # 计算最小代价 total_cost = 0 for i in range(n): total_cost += num_sorted[i] * i - cost_sorted[i] # 对结果取模 result = total_cost % (264) print(result) ``` ######[AI写代码神器 | 257点数解答 | 2024-11-10 19:20:48]

相关提问
本站限时免费提问中
实用工具查看更多
Linux在线手册 [开发类]
Jquery在线手册 [开发类]
今日油价 [生活类]
图片互转base64 [开发类]
时间转换器 [开发类]