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