forked from QingdaoU/JudgeServer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.php
More file actions
94 lines (74 loc) · 1.81 KB
/
Copy pathclient.php
File metadata and controls
94 lines (74 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
require('JudgeClient.php');
$token = 'YOUR_TOKEN_HERE';
$cSrc = <<<'CODE'
#include <stdio.h>
int main(){
int a, b;
scanf("%d%d", &a, &b);
printf("%d\n", a+b);
return 0;
}
CODE;
$cSpjSrc = <<<'CODE'
#include <stdio.h>
int main(){
return 1;
}
CODE;
$cppSrc = <<<'CODE'
#include <iostream>
using namespace std;
int main()
{
int a,b;
cin >> a >> b;
cout << a+b << endl;
return 0;
}
CODE;
$javaSrc = <<<'CODE'
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner in=new Scanner(System.in);
int a=in.nextInt();
int b=in.nextInt();
System.out.println(a + b);
}
}
CODE;
$py2src = <<<'CODE'
s = raw_input()
s1 = s.split(" ")
print int(s1[0]) + int(s1[1])
CODE;
$py3src = <<<'CODE'
s = input()
s1 = s.split(" ")
print(int(s1[0]) + int(s1[1]))
CODE;
$judgeClient = new JudgeClient($token, 'http://127.0.0.1:12358');
echo "ping:\n";
print_r($judgeClient->ping());
echo "\n\ncompile_spj:\n";
print_r($judgeClient->compileSpj($cSpjSrc, '2', JudgeClient::getLanguageConfigByKey('c_lang_spj_compile')));
echo "\n\nc_judge:\n";
print_r($judgeClient->judge($cSrc, 'c', 'normal', [
'output' => true
]));
echo "\n\nc_spj_judge:\n";
print_r($judgeClient->judge($cSrc, 'c', 'spj', [
'spj_version' => '3',
'spj_config' => JudgeClient::getLanguageConfigByKey('c_lang_spj_config'),
'spj_compile_config' => JudgeClient::getLanguageConfigByKey('c_lang_spj_compile'),
'spj_src' => $cSpjSrc,
]));
echo "\n\ncpp_judge:\n";
print_r($judgeClient->judge($cppSrc, 'cpp', 'normal'));
echo "\n\njava_judge:\n";
print_r($judgeClient->judge($javaSrc, 'java', 'normal'));
echo "\n\npy2_judge:\n";
print_r($judgeClient->judge($py2src, 'py2', 'normal'));
echo "\n\npy3_judge:\n";
print_r($judgeClient->judge($py3src, 'py3', 'normal'));