| 模型 | 模型答案 | 正确答案 |
|---|---|---|
| 金声玉亮2.0 | ```python from typing import List class Solution: def countTestedDevices(self, batteryPercentages: List[int]) -> int: tested_devices = 0 n = len(batteryPercentages) for i in range(n): if batteryPercentages[i] > 0: tested_devices += 1 for j in range(i + 1, n): batteryPercentages[j] = max(0, batteryPercentages[j] - 1) return tested_devices ``` |
[{"input": "[1, 1, 2, 1, 3]", "output": "3", "testtype": "functional"}, {"input": "[0, 1, 2]", "output": "2", "testtype": "functional"}] |
| deepseek-r1 | ```python from typing import List class Solution: def countTestedDevices(self, batteryPercentages: List[int]) -> int: tests_so_far = 0 count = 0 for battery in batteryPercentages: adjusted = battery - tests_so_far if adjusted > 0: count += 1 tests_so_far += 1 return count ``` |
[{"input": "[1, 1, 2, 1, 3]", "output": "3", "testtype": "functional"}, {"input": "[0, 1, 2]", "output": "2", "testtype": "functional"}] |
| gpto1 | ```python class Solution: def countTestedDevices(self, batteryPercentages: List[int]) -> int: count = 0 n = len(batteryPercentages) for i in range(n): if batteryPercentages[i] > 0: count += 1 for j in range(i+1, n): batteryPercentages[j] = max(0, batteryPercentages[j] - 1) return count ``` |
[{"input": "[1, 1, 2, 1, 3]", "output": "3", "testtype": "functional"}, {"input": "[0, 1, 2]", "output": "2", "testtype": "functional"}] |
| gpt-4o-2024-08-06 | ```python class Solution: def countTestedDevices(self, batteryPercentages: List[int]) -> int: n = len(batteryPercentages) tested_devices = 0 for i in range(n): if batteryPercentages[i] > 0: tested_devices += 1 for j in range(i + 1, n): batteryPercentages[j] = max(0, batteryPercentages[j] - 1) return tested_devices ``` |
[{"input": "[1, 1, 2, 1, 3]", "output": "3", "testtype": "functional"}, {"input": "[0, 1, 2]", "output": "2", "testtype": "functional"}] |
| DeepSeek-Coder-V2-Lite-Instruct | ```python from typing import List class Solution: def countTestedDevices(self, batteryPercentages: List[int]) -> int: tested_devices = 0 n = len(batteryPercentages) for i in range(n): if batteryPercentages[i] > 0: tested_devices += 1 for j in range(i + 1, n): batteryPercentages[j] = max(0, batteryPercentages[j] - 1) return tested_devices ``` |
[{"input": "[1, 1, 2, 1, 3]", "output": "3", "testtype": "functional"}, {"input": "[0, 1, 2]", "output": "2", "testtype": "functional"}] |
| Meta-Llama-3.1-405B-Instruct-Turbo | ```python from typing import List class Solution: def countTestedDevices(self, batteryPercentages: List[int]) -> int: n = len(batteryPercentages) tested_devices = 0 for i in range(n): if batteryPercentages[i] > 0: tested_devices += 1 for j in range(i + 1, n): batteryPercentages[j] = max(0, batteryPercentages[j] - 1) return tested_devices ``` |
[{"input": "[1, 1, 2, 1, 3]", "output": "3", "testtype": "functional"}, {"input": "[0, 1, 2]", "output": "2", "testtype": "functional"}] |
| Meta-Llama-3.1-70B-Instruct-Turbo | ```python class Solution: def countTestedDevices(self, batteryPercentages: List[int]) -> int: tested_devices = 0 for i in range(len(batteryPercentages)): if batteryPercentages[i] > 0: tested_devices += 1 for j in range(i + 1, len(batteryPercentages)): batteryPercentages[j] = max(0, batteryPercentages[j] - 1) return tested_devices ``` |
[{"input": "[1, 1, 2, 1, 3]", "output": "3", "testtype": "functional"}, {"input": "[0, 1, 2]", "output": "2", "testtype": "functional"}] |
| Qwen2-72B-Instruct | ```python class Solution: def countTestedDevices(self, batteryPercentages: List[int]) -> int: tested = 0 for percent in batteryPercentages: if percent > tested: tested += 1 return tested ``` |
[{"input": "[1, 1, 2, 1, 3]", "output": "3", "testtype": "functional"}, {"input": "[0, 1, 2]", "output": "2", "testtype": "functional"}] |
| baichuan4 | ```python class Solution: def countTestedDevices(self, batteryPercentages: List[int]) -> int: tested_devices = 0 for i in range(len(batteryPercentages)): if batteryPercentages[i] > 0: tested_devices += 1 for j in range(i + 1, len(batteryPercentages)): batteryPercentages[j] = max(0, batteryPercentages[j] - 1) return tested_devices ``` |
[{"input": "[1, 1, 2, 1, 3]", "output": "3", "testtype": "functional"}, {"input": "[0, 1, 2]", "output": "2", "testtype": "functional"}] |
| doubao | ```python class Solution: def countTestedDevices(self, batteryPercentages: List[int]) -> int: count = 0 for i in range(len(batteryPercentages)): if batteryPercentages[i] > 0: count += 1 for j in range(i + 1, len(batteryPercentages)): batteryPercentages[j] = max(0, batteryPercentages[j] - 1) return count ``` |
[{"input": "[1, 1, 2, 1, 3]", "output": "3", "testtype": "functional"}, {"input": "[0, 1, 2]", "output": "2", "testtype": "functional"}] |
| gpto1 | ```python class Solution: def countTestedDevices(self, batteryPercentages: List[int]) -> int: count = 0 n = len(batteryPercentages) for i in range(n): if batteryPercentages[i] > 0: count += 1 for j in range(i+1, n): batteryPercentages[j] = max(0, batteryPercentages[j] - 1) return count ``` |
[{"input": "[1, 1, 2, 1, 3]", "output": "3", "testtype": "functional"}, {"input": "[0, 1, 2]", "output": "2", "testtype": "functional"}] |
| kimi | ```python from typing import List class Solution: def countTestedDevices(self, batteryPercentages: List[int]) -> int: tested_devices = 0 for i in range(len(batteryPercentages)): if batteryPercentages[i] > 0: tested_devices += 1 for j in range(i + 1, len(batteryPercentages)): batteryPercentages[j] = max(0, batteryPercentages[j] - 1) return tested_devices ``` |
[{"input": "[1, 1, 2, 1, 3]", "output": "3", "testtype": "functional"}, {"input": "[0, 1, 2]", "output": "2", "testtype": "functional"}] |
| minimax | ```python from typing import List class Solution: def countTestedDevices(self, batteryPercentages: List[int]) -> int: tested_count = 0 n = len(batteryPercentages) for i in range(n): if batteryPercentages[i] > 0: tested_count += 1 for j in range(i + 1, n): batteryPercentages[j] = max(0, batteryPercentages[j] - 1) return tested_count ``` |
[{"input": "[1, 1, 2, 1, 3]", "output": "3", "testtype": "functional"}, {"input": "[0, 1, 2]", "output": "2", "testtype": "functional"}] |
| wenxinyiyan | ```python class Solution: def countTestedDevices(self, batteryPercentages: List[int]) -> int: tested_devices = 0 n = len(batteryPercentages) for i in range(n): if batteryPercentages[i] > 0: tested_devices += 1 for j in range(i + 1, n): batteryPercentages[j] = max(0, batteryPercentages[j] - 1) return tested_devices ``` This solution iterates through the `batteryPercentages` list using a for loop. For each device `i`, it checks if the battery percentage is greater than 0. If it is, it increments the `tested_devices` count by 1 and then decreases the battery percentage of all devices with indices `j` in the range `[i + 1, n - 1]` by 1, ensuring their battery percentage never goes below 0 using the `max` function. Finally, it returns the total count of tested devices. |
[{"input": "[1, 1, 2, 1, 3]", "output": "3", "testtype": "functional"}, {"input": "[0, 1, 2]", "output": "2", "testtype": "functional"}] |
| zhipu | ```python class Solution: def countTestedDevices(self, batteryPercentages: List[int]) -> int: tested_count = 0 n = len(batteryPercentages) for i in range(n): if batteryPercentages[i] > 0: tested_count += 1 for j in range(i + 1, n): batteryPercentages[j] = max(0, batteryPercentages[j] - 1) return tested_count ``` |
[{"input": "[1, 1, 2, 1, 3]", "output": "3", "testtype": "functional"}, {"input": "[0, 1, 2]", "output": "2", "testtype": "functional"}] |
| deepseek-v3 | ```python class Solution: def countTestedDevices(self, batteryPercentages: List[int]) -> int: tested = 0 for i in range(len(batteryPercentages)): if batteryPercentages[i] > 0: tested += 1 for j in range(i+1, len(batteryPercentages)): batteryPercentages[j] = max(0, batteryPercentages[j] - 1) return tested ``` |
[{"input": "[1, 1, 2, 1, 3]", "output": "3", "testtype": "functional"}, {"input": "[0, 1, 2]", "output": "2", "testtype": "functional"}] |