python计算邮资openjudge
时间: 2023-11-05 22:05:15 浏览: 104
计算邮资openjudge的Python代码如下所示:
```python
n, m = map(int, input().split())
t = {}
for i in range(m):
s = input().split()
name, price, num = s[0], int(s[1]), int(s[2])
t[name] = [price, num]
total = 0
for i in range(n):
names = input().split()
for name in names:
if t[name][1] > 0:
total += t[name][0]
t[name][1] -= 1
print(total)
```
阅读全文