mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-17 23:12:23 +00:00
bugs: fix bugs in coding template
This commit is contained in:
commit
4a17552093
@ -415,14 +415,10 @@ string formatOutput(const vector<int>& res) {
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
// Solution 类
|
||||
// Solution 类声明
|
||||
class Solution {
|
||||
public:
|
||||
// 调用独立的算法函数
|
||||
vector<int> twoSum(vector<int>& nums, int target) {
|
||||
// 算法部分留空,放在文件末尾
|
||||
return {};
|
||||
}
|
||||
vector<int> twoSum(vector<int>& nums, int target);
|
||||
};
|
||||
|
||||
int main() {
|
||||
@ -442,12 +438,10 @@ int main() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
vector<int> Solution::twoSum(vector<int>& nums, int target) {
|
||||
|
||||
vector<int> findTwoSum(const vector<int>& nums, int target) {
|
||||
|
||||
return {}; // 在这里填充你的算法逻辑
|
||||
return findTwoSum(nums, target);
|
||||
}
|
||||
|
||||
`,
|
||||
},
|
||||
],
|
||||
@ -631,7 +625,7 @@ $(3 → 4 → 2) + (4 → 6 → 5) = 8 → 0 → 7$`,
|
||||
{
|
||||
language: "c",
|
||||
template: `
|
||||
#include <stdio.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -716,7 +710,7 @@ struct ListNode* addTwoNumbers(struct ListNode* l1, struct ListNode* l2) {
|
||||
{
|
||||
language: "cpp",
|
||||
template: `
|
||||
#include <iostream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
@ -731,6 +725,12 @@ struct ListNode {
|
||||
ListNode(int x, ListNode *next) : val(x), next(next) {}
|
||||
};
|
||||
|
||||
// 声明 Solution 类
|
||||
class Solution {
|
||||
public:
|
||||
ListNode* addTwoNumbers(ListNode* l1, ListNode* l2);
|
||||
};
|
||||
|
||||
// 输入字符串 -> 链表
|
||||
ListNode* createList(const string& line) {
|
||||
ListNode dummy;
|
||||
@ -1058,6 +1058,11 @@ double findMedianSortedArrays(int* nums1, int nums1Size, int* nums2, int nums2Si
|
||||
#include <algorithm>
|
||||
using namespace std;
|
||||
|
||||
class Solution {
|
||||
public:
|
||||
double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2);
|
||||
};
|
||||
|
||||
// 解析输入为整数数组
|
||||
vector<int> parseIntArray(const string& line) {
|
||||
string trimmed = line;
|
||||
@ -1091,13 +1096,10 @@ int main() {
|
||||
|
||||
|
||||
|
||||
class Solution {
|
||||
public:
|
||||
double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {
|
||||
|
||||
return 0.0; // 临时返回值,待填充
|
||||
}
|
||||
};
|
||||
double Solution::findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {
|
||||
|
||||
return 0.0; // 临时返回值,待填充
|
||||
}
|
||||
`,
|
||||
},
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user