#abc308b. B - Default Price
B - Default Price
Score : points
问题描述
高桥在一家寿司店吃了 盘寿司。第 盘寿司的颜色用字符串 表示。
每种寿司的价格与其盘子颜色相对应。对于每个 ,颜色表示为字符串 的盘子上的寿司价值 日元/盘(日元是日本的货币)。如果颜色与 中任何一个都不吻合,则该寿司价值 日元/盘。
请计算高桥所吃寿司的总价格。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Takahashi ate plates of sushi at a sushi restaurant. The color of the -th plate is represented by a string .
The price of a sushi corresponds to the color of the plate. For each , the sushi on a plate whose color is represented by a string is worth yen a plate (yen is the currency of Japan). If the color does not coincide with any of , and , it is worth yen a plate.
Find the total amount of the prices of sushi that Takahashi ate.
Constraints
- and are strings of length between and , inclusive, consisting of lowercase English letters.
- , and are distinct.
- , , and are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer as an integer.
Sample Input 1
3 2
red green blue
blue red
800 1600 2800
Sample Output 1
5200
A blue
plate, red
plate, and green
plate are worth , , and yen, respectively.
The total amount of the prices of the sushi that he ate is yen.
Sample Input 2
3 2
code queen atcoder
king queen
10 1 1
Sample Output 2
21
update @ 2024/3/10 08:43:37