blumonilr 5 лет назад
Родитель
Сommit
11ec49d92c
2 измененных файлов с 15 добавлено и 3 удалено
  1. 12 0
      demo/Main.java
  2. 3 3
      demo/test.py

+ 12 - 0
demo/Main.java

@@ -0,0 +1,12 @@
+import java.util.Scanner;
+
+public class Main {
+    public static void main(String[] args) {
+        Scanner scanner = new Scanner(System.in);
+        while (scanner.hasNext()){
+            int a = scanner.nextInt();
+            int b = scanner.nextInt();
+            System.out.println(a+b);
+        }
+    }
+}

+ 3 - 3
demo/test.py

@@ -17,7 +17,7 @@ RESULT_STR = [
 ]
 
 def compileSrc(src_path):
-    if os.system('python -m py_compile %s' % src_path) != 0:
+    if os.system('javac %s' % src_path) != 0:
         print('compile failure!')
         return False
     return True
@@ -27,7 +27,7 @@ def runone(p_path, in_path, out_path):
     ftemp = open('temp.out', 'w')
     
     runcfg = {
-        'args':['python ./add.py'],
+        'args':['java', './Main'],
         'fd_in':fin.fileno(),
         'fd_out':ftemp.fileno(),
         'timelimit':1000, #in MS
@@ -64,7 +64,7 @@ def judge(src_path, td_path, td_total):
             print('testdata:%d incompleted' % i)
             os.remove('./m')
             exit(-1)
-    os.remove('./m')
+    os.remove('./Main.class')
 
 
 if __name__ == '__main__':