chore: add more template

This commit is contained in:
Mikucat 2024-01-29 16:05:19 +08:00
parent 8a29563af9
commit 5307965efe
No known key found for this signature in database
GPG Key ID: CE6B09A6F462E04D

View File

@ -10,14 +10,13 @@ _c_lang_config = {
//TEMPLATE BEGIN //TEMPLATE BEGIN
int add(int a, int b) { int add(int a, int b) {
// Please fill this blank // code
return ___________;
} }
//TEMPLATE END //TEMPLATE END
//APPEND BEGIN //APPEND BEGIN
int main() { int main() {
printf("%d", add(1, 2)); printf("%d\n", add(1, 2));
return 0; return 0;
} }
//APPEND END""", //APPEND END""",
@ -58,14 +57,13 @@ _cpp_lang_config = {
//TEMPLATE BEGIN //TEMPLATE BEGIN
int add(int a, int b) { int add(int a, int b) {
// Please fill this blank // code
return ___________;
} }
//TEMPLATE END //TEMPLATE END
//APPEND BEGIN //APPEND BEGIN
int main() { int main() {
std::cout << add(1, 2); std::cout << add(1, 2) << std::endl;
return 0; return 0;
} }
//APPEND END""", //APPEND END""",
@ -101,12 +99,20 @@ _cpp_lang_spj_config = {
_java_lang_config = { _java_lang_config = {
"template": """//PREPEND BEGIN "template": """//PREPEND BEGIN
class Main {
//PREPEND END //PREPEND END
//TEMPLATE BEGIN //TEMPLATE BEGIN
static int add(int a, int b) {
// code
}
//TEMPLATE END //TEMPLATE END
//APPEND BEGIN //APPEND BEGIN
public static void main(String [] args) {
System.out.println(add(1, 2));
}
}
//APPEND END""", //APPEND END""",
"compile": { "compile": {
"src_name": "Main.java", "src_name": "Main.java",
@ -154,9 +160,13 @@ _py3_lang_config = {
//PREPEND END //PREPEND END
//TEMPLATE BEGIN //TEMPLATE BEGIN
def add(a, b):
# code
//TEMPLATE END //TEMPLATE END
//APPEND BEGIN //APPEND BEGIN
print(add(1, 2))
//APPEND END""", //APPEND END""",
"compile": { "compile": {
"src_name": "solution.py", "src_name": "solution.py",
@ -175,12 +185,21 @@ _py3_lang_config = {
_go_lang_config = { _go_lang_config = {
"template": """//PREPEND BEGIN "template": """//PREPEND BEGIN
package main
import "fmt"
//PREPEND END //PREPEND END
//TEMPLATE BEGIN //TEMPLATE BEGIN
func add(a int, b int) int {
// code
}
//TEMPLATE END //TEMPLATE END
//APPEND BEGIN //APPEND BEGIN
func main() {
fmt.Println(add(1, 2))
}
//APPEND END""", //APPEND END""",
"compile": { "compile": {
"src_name": "main.go", "src_name": "main.go",
@ -205,9 +224,13 @@ _node_lang_config = {
//PREPEND END //PREPEND END
//TEMPLATE BEGIN //TEMPLATE BEGIN
function add(a, b) {
// code
}
//TEMPLATE END //TEMPLATE END
//APPEND BEGIN //APPEND BEGIN
console.log(add(1, 2))
//APPEND END""", //APPEND END""",
"compile": { "compile": {
"src_name": "main.js", "src_name": "main.js",
@ -221,7 +244,6 @@ _node_lang_config = {
"run": { "run": {
"command": "/usr/bin/node {exe_path}", "command": "/usr/bin/node {exe_path}",
"seccomp_rule": "node", "seccomp_rule": "node",
# 降低内存占用
"env": default_env, "env": default_env,
"memory_limit_check_only": 1 "memory_limit_check_only": 1
} }