8
8
9
9
<!-- problem:start -->
10
10
11
- # [ 3293. Calculate Product Final Price 🔒] ( https://leetcode.cn/problems/calculate-product-final-price )
11
+ # [ 3293. 计算产品最终价格 🔒] ( https://leetcode.cn/problems/calculate-product-final-price )
12
12
13
13
[ English Version] ( /solution/3200-3299/3293.Calculate%20Product%20Final%20Price/README_EN.md )
14
14
15
15
## 题目描述
16
16
17
17
<!-- description:start -->
18
18
19
- <p >Table: <font face =" monospace " ><code >Products</code ></font ></p >
19
+ <p >表: <font face =" monospace " ><code >Products</code ></font ></p >
20
20
21
21
<pre >
22
22
+------------+---------+
@@ -26,11 +26,11 @@ tags:
26
26
| category | varchar |
27
27
| price | decimal |
28
28
+------------+---------+
29
- product_id is the unique key for this table.
30
- Each row includes the product &# 39 ; s ID, its category, and its price.
29
+ product_id 是这张表的唯一主键。
30
+ 每一行包含产品的 ID,分类以及价格。
31
31
</pre >
32
32
33
- <p >Table: <font face =" monospace " ><code >Discounts</code ></font ></p >
33
+ <p >表: <font face =" monospace " ><code >Discounts</code ></font ></p >
34
34
35
35
<pre >
36
36
+------------+---------+
@@ -39,23 +39,24 @@ Each row includes the product's ID, its category, and its price.
39
39
| category | varchar |
40
40
| discount | int |
41
41
+------------+---------+
42
- category is the primary key for this table.
43
- Each row contains a product category and the percentage discount applied to that category (values range from 0 to 100).
42
+ category 是这张表的主键。
43
+ 每一行包含有一个产品分类和该分类的折扣百分比(值的范围从 0 到 100)。
44
44
</pre >
45
45
46
- <p >Write a solution to find the <strong >final price </strong > of each product after applying the < strong >category discount</ strong >. If a product &# 39 ; s category has <strong >no </strong > <strong >associated </strong > <strong >discount </strong >, its price remains < strong >unchanged</ strong >. </p >
46
+ <p >编写一个解决方案来找到每个产品使用 <strong >分类折扣 </strong >& nbsp ; 后的 <strong >最终价格 </strong >。如果一个产品分类 <strong >没有关联的折扣 </strong >,它的价格保持 <strong >不变 </strong >。 </p >
47
47
48
- <p >Return < em >the result table ordered by</ em > < code >product_id</code ><em > in < strong >ascending</ strong > order.</ em > </p >
48
+ <p >返回结果表以 & nbsp ; < code >product_id</code ><em > </ em >< strong >升序 & nbsp ; </ strong >排序。 </p >
49
49
50
- <p >The result format is in the following example. </p >
50
+ <p >结果格式如下所示。 </p >
51
51
52
52
<p >  ; </p >
53
- <p ><strong class =" example " >Example:</strong ></p >
53
+
54
+ <p ><strong class =" example " >示例:</strong ></p >
54
55
55
56
<div class =" example-block " >
56
- <p ><strong >Input: </strong ></p >
57
+ <p ><strong >输入: </strong ></p >
57
58
58
- <p ><code >Products</code > table: </p >
59
+ <p ><code >Products</code > 表: </p >
59
60
60
61
<pre class =" example-io " >
61
62
+------------+-------------+-------+
@@ -68,7 +69,7 @@ Each row contains a product category and the percentage discount applied to that
68
69
+------------+-------------+-------+
69
70
</pre >
70
71
71
- <p ><code >Discounts</code > table: </p >
72
+ <p ><code >Discounts</code > 表: </p >
72
73
73
74
<pre class =" example-io " >
74
75
+------------+----------+
@@ -79,7 +80,7 @@ Each row contains a product category and the percentage discount applied to that
79
80
+------------+----------+
80
81
</pre >
81
82
82
- <p ><strong >Output: </strong ></p >
83
+ <p ><strong >输出: </strong ></p >
83
84
84
85
<pre class =" example-io " >
85
86
+------------+------------+-------------+
@@ -92,15 +93,15 @@ Each row contains a product category and the percentage discount applied to that
92
93
+------------+------------+-------------+
93
94
</pre >
94
95
95
- <p ><strong >Explanation: </strong ></p >
96
+ <p ><strong >解释: </strong ></p >
96
97
97
98
<ul >
98
- <li>For product 1, it belongs to the Electronics category which has a 10% discount, so the final price is 1000 - (10% of 1000) = 900. </li>
99
- <li>For product 2, it belongs to the Clothing category which has a 20% discount, so the final price is 50 - (20% of 50) = 40. </li>
100
- <li>For product 3, it belongs to the Electronics category and receives a 10% discount, so the final price is 1200 - (10% of 1200) = 1080. </li>
101
- <li>For product 4, no discount is available for the Home category, so the final price remains 500. </li>
99
+ <li>对于产品 1,它属于电器分类,有 10% 的折扣,所以最终价格为 1000 - (10% of 1000) = 900。 </li>
100
+ <li>对于产品 2,它属于衣物分类,有 20% 的折扣,所以最终价格为 50 - (20% of 50) = 40。 </li>
101
+ <li>对于产品 3,它属于电器分类,有 10% 的折扣,所以最终价格为 1200 - (10% of 1200) = 1080。 </li>
102
+ <li>对于产品 4,它属于家具分类,没有可用的折扣,所以最终价格仍是 500。 </li>
102
103
</ul >
103
- Result table is ordered by product_id in ascending order. </div >
104
+ 结果表以 product_id 升序排序。 </div >
104
105
105
106
<!-- description:end -->
106
107
0 commit comments