88
99<!-- problem:start -->
1010
11- # [ 3601. Find Drivers with Improved Fuel Efficiency ] ( https://leetcode.cn/problems/find-drivers-with-improved-fuel-efficiency )
11+ # [ 3601. 寻找燃油效率提升的驾驶员 ] ( https://leetcode.cn/problems/find-drivers-with-improved-fuel-efficiency )
1212
1313[ English Version] ( /solution/3600-3699/3601.Find%20Drivers%20with%20Improved%20Fuel%20Efficiency/README_EN.md )
1414
1515## 题目描述
1616
1717<!-- description:start -->
1818
19- <p >Table: <code >drivers</code ></p >
19+ <p >表: <code >drivers</code ></p >
2020
2121<pre >
2222+-------------+---------+
@@ -25,11 +25,11 @@ tags:
2525| driver_id | int |
2626| driver_name | varchar |
2727+-------------+---------+
28- driver_id is the unique identifier for this table.
29- Each row contains information about a driver.
28+ driver_id 是这张表的唯一主键。
29+ 每一行都包含一个司机的信息。
3030</pre >
3131
32- <p >Table: <code >trips</code ></p >
32+ <p >表: <code >trips</code ></p >
3333
3434<pre >
3535+---------------+---------+
@@ -41,31 +41,32 @@ Each row contains information about a driver.
4141| distance_km | decimal |
4242| fuel_consumed | decimal |
4343+---------------+---------+
44- trip_id is the unique identifier for this table.
45- Each row represents a trip made by a driver, including the distance traveled and fuel consumed for that trip.
44+ trip_id 是这张表的唯一主键。
45+ 每一行表示一名司机完成的一次行程,包括该次行程行驶的距离和消耗的燃油量。
4646</pre >
4747
48- <p >Write a solution to find drivers whose <strong >fuel efficiency has improved </strong > by <strong >comparing </strong > their average fuel efficiency in the <strong > first half< /strong > of the year with the <strong >second half </strong > of the year. </p >
48+ <p >编写一个解决方案,通过 <strong >比较 </strong > 司机在 <strong >上半年 </strong > 和 <strong >下半年</ strong > 的 < strong >平均燃油效率< /strong > 来找出 <strong >燃油效率有所提高 </strong > 的司机。 </p >
4949
5050<ul >
51- <li>Calculate <strong>fuel efficiency</strong> as < code>distance_km / fuel_consumed</code> for <strong>each </strong> trip </li>
52- <li><strong>First half </strong>: January to June, <strong>Second half </strong>: July to December </li>
53- <li>Only include drivers who have trips in <strong>both halves</strong> of the year </li>
54- <li>Calculate the <strong>efficiency improvement</strong> as (< code>second_half_avg - first_half_avg</code>) </li>
55- <li><strong>Round </ strong>all<strong> < /strong>results<strong> </strong>to<strong> <code>2</code> </strong>decimal<strong> </strong>places </li>
51+ <li>通过 < code>distance_km / fuel_consumed</code> 计算 <strong>每次 </strong> 行程的 <strong>燃油效率</strong>。 </li>
52+ <li><strong>上半年: </strong>一月到六月, <strong>下半年: </strong>七月到十二月 </li>
53+ <li>只包含在上半年和下半年都有行程的司机 </li>
54+ <li>通过(< code>second_half_avg - first_half_avg</code>)计算 <strong>提升效率</strong>。 </li>
55+ <li>将所有结果 < strong>四舍五入< /strong> 到小数点后 <code>2</code> 位 </li>
5656</ul >
5757
58- <p >Return < em >the result table ordered by efficiency improvement in < strong >descending </strong > order, then by driver name in <strong >ascending </strong > order</ em >. </p >
58+ <p >返回结果表按提升效率 & nbsp ; < strong >降序 </strong > 排列,然后按司机姓名 <strong >升序 </strong > 排列。 </p >
5959
60- <p >The result format is in the following example. </p >
60+ <p >结果格式如下所示。 </p >
6161
6262<p >  ; </p >
63- <p ><strong class =" example " >Example:</strong ></p >
63+
64+ <p ><strong class =" example " >示例:</strong ></p >
6465
6566<div class =" example-block " >
66- <p ><strong >Input: </strong ></p >
67+ <p ><strong >输入: </strong ></p >
6768
68- <p >drivers table: </p >
69+ <p >drivers 表: </p >
6970
7071<pre class =" example-io " >
7172+-----------+---------------+
@@ -79,7 +80,7 @@ Each row represents a trip made by a driver, including the distance traveled and
7980+-----------+---------------+
8081</pre >
8182
82- <p >trips table: </p >
83+ <p >trips 表: </p >
8384
8485<pre class =" example-io " >
8586+---------+-----------+------------+-------------+---------------+
@@ -100,7 +101,7 @@ Each row represents a trip made by a driver, including the distance traveled and
100101+---------+-----------+------------+-------------+---------------+
101102</pre >
102103
103- <p ><strong >Output: </strong ></p >
104+ <p ><strong >输出: </strong ></p >
104105
105106<pre class =" example-io " >
106107+-----------+---------------+------------------+-------------------+------------------------+
@@ -111,39 +112,39 @@ Each row represents a trip made by a driver, including the distance traveled and
111112+-----------+---------------+------------------+-------------------+------------------------+
112113</pre >
113114
114- <p ><strong >Explanation: </strong ></p >
115+ <p ><strong >解释: </strong ></p >
115116
116117<ul >
117118 <li><strong>Alice Johnson (driver_id = 1):</strong>
118119
119120 <ul>
120- <li>First half trips (Jan-Jun): Feb 15 (120.5/10.2 = 11.81), Mar 20 (200.0/16.5 = 12.12)</li>
121- <li>First half average efficiency: (11.81 + 12.12) / 2 = 11.97</li>
122- <li>Second half trips (Jul-Dec): Aug 10 (150.0/11.0 = 13.64), Sep 25 (180.0/12.5 = 14.40)</li>
123- <li>Second half average efficiency: (13.64 + 14.40) / 2 = 14.02</li>
124- <li>Efficiency improvement: 14.02 - 11.97 = 2.05</li>
121+ <li>上半年行程(一月到六月): Feb 15 (120.5/10.2 = 11.81), Mar 20 (200.0/16.5 = 12.12)</li>
122+ <li>上半年平均效率: (11.81 + 12.12) / 2 = 11.97</li>
123+ <li>下半年行程(七月到十二月): Aug 10 (150.0/11.0 = 13.64), Sep 25 (180.0/12.5 = 14.40)</li>
124+ <li>下半年平均效率: (13.64 + 14.40) / 2 = 14.02</li>
125+ <li>效率提升: 14.02 - 11.97 = 2.05</li>
125126 </ul>
126127 </li>
127128 <li><strong>Bob Smith (driver_id = 2):</strong>
128129 <ul>
129- <li>First half trips: Jan 10 (100.0/9.0 = 11.11), Apr 15 (250.0/22.0 = 11.36)</li>
130- <li>First half average efficiency: (11.11 + 11.36) / 2 = 11.24</li>
131- <li>Second half trips: Oct 5 (200.0/15.0 = 13.33)</li>
132- <li>Second half average efficiency: 13.33</li>
133- <li>Efficiency improvement: 13.33 - 11.24 = 2.09</li>
130+ <li>上半年行程: Jan 10 (100.0/9.0 = 11.11), Apr 15 (250.0/22.0 = 11.36)</li>
131+ <li>上半年平均效率: (11.11 + 11.36) / 2 = 11.24</li>
132+ <li>下半年行程: Oct 5 (200.0/15.0 = 13.33)</li>
133+ <li>下半年平均效率: 13.33</li>
134+ <li>效率提升: 13.33 - 11.24 = 2.09</li>
134135 </ul>
135136 </li>
136- <li><strong>Drivers not included: </strong>
137+ <li><strong>未包含的司机: </strong>
137138 <ul>
138- <li>Carol Davis (driver_id = 3): Only has trips in first half (Mar, May) </li>
139- <li>David Wilson (driver_id = 4): Only has trips in second half (Jul, Nov) </li>
140- <li>Emma Brown (driver_id = 5): Only has trips in first half (Feb) </li>
139+ <li>Carol Davis (driver_id = 3):只有上半年的行程(三月,五月) </li>
140+ <li>David Wilson (driver_id = 4):只有下半年的行程(七月,十一月) </li>
141+ <li>Emma Brown (driver_id = 5):只有上半年的行程(二月) </li>
141142 </ul>
142143 </li>
143144
144145</ul >
145146
146- <p >The output table is ordered by efficiency improvement in descending order then by name in ascending order. </p >
147+ <p >输出表按提升效率降序排列,然后按司机名字升序排列。 </p >
147148</div >
148149
149150<!-- description:end -->
0 commit comments