mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2024-12-28 16:12:13 +00:00
增加java编译参数
This commit is contained in:
parent
ef88a8a155
commit
c033b2c1e8
@ -209,7 +209,7 @@ class JudgeClient(object):
|
||||
|
||||
|
||||
|
||||
src = """
|
||||
c_src = """
|
||||
#include <stdio.h>
|
||||
int main()
|
||||
{
|
||||
@ -217,14 +217,30 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
"""
|
||||
f = open("/var/judger/main.c", "w")
|
||||
f.write(src)
|
||||
f.close()
|
||||
|
||||
client = JudgeClient(language_code=1,
|
||||
exe_path=compile_(languages["1"], "/var/judger/main.c", "/var/judger/main"),
|
||||
max_cpu_time=1000000,
|
||||
max_real_time=200000,
|
||||
max_memory=1,
|
||||
test_case_dir="/var/test_cases/1/")
|
||||
print client.run()
|
||||
java_src = """
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.out.print("Hello world");
|
||||
}
|
||||
}
|
||||
"""
|
||||
def judge(languege_code, source_string):
|
||||
language = languages[str(languege_code)]
|
||||
src_path = judger_workspace + language["src_name"]
|
||||
f = open(src_path, "w")
|
||||
f.write(source_string)
|
||||
f.close()
|
||||
|
||||
client = JudgeClient(language_code=languege_code,
|
||||
exe_path=compile_(languages[str(languege_code)],
|
||||
src_path,
|
||||
judger_workspace),
|
||||
max_cpu_time=1000000,
|
||||
max_real_time=200000,
|
||||
max_memory=1000,
|
||||
test_case_dir="/var/test_cases/1/")
|
||||
print client.run()
|
||||
|
||||
judge(1, c_src)
|
||||
judge(3, java_src)
|
@ -5,21 +5,24 @@
|
||||
languages = {
|
||||
"1": {
|
||||
"name": "c",
|
||||
"src_name": "main.c",
|
||||
"code": 1,
|
||||
"compile_command": "gcc -DONLINE_JUDGE -O2 -Wall -std=c99 -pipe {src_path} -lm -o {exe_path}",
|
||||
"execute_command": "{exe_path}"
|
||||
"compile_command": "gcc -DONLINE_JUDGE -O2 -Wall -std=c99 -pipe {src_path} -lm -o {exe_path}main",
|
||||
"execute_command": "{exe_path}main"
|
||||
},
|
||||
"2": {
|
||||
"name": "cpp",
|
||||
"src_name": "main.cpp",
|
||||
"code": 2,
|
||||
"compile_command": "g++ -DONLINE_JUDGE -O2 -Wall -std=c++11 -pipe {src_path} -lm -o {exe_path}",
|
||||
"execute_command": "{exe_path}"
|
||||
"compile_command": "g++ -DONLINE_JUDGE -O2 -Wall -std=c++11 -pipe {src_path} -lm -o {exe_path}main",
|
||||
"execute_command": "{exe_path}main"
|
||||
},
|
||||
"3": {
|
||||
"name": "java",
|
||||
"src_name": "Main.java",
|
||||
"code": 3,
|
||||
"compile_command": "javac {src_path} -d {exe_path}",
|
||||
"execute_command": "java {exe_path}"
|
||||
"execute_command": "java -cp {exe_path} Main"
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user