python对拍程序

python

 1 import sys;

2 import random;

3 import os;

4 gen=open("data.in","w");

5 #///生成测试数据

6 gen.close();

7 os.system("STD.exe");

8 os.system("CHX.exe");

9 f1=open("STD.out","r");

10 f2=open("CHX.out","r");

11 f3=open("result.txt","w");

12 cnt=1;tot=0;ans=True;

13 while True:

14 a1=f1.readline();

15 if not a1:break;

16 a2=f2.readline();

17 if(a1!=a2):

18 tot=tot+1;

19 f3.write("line"+str(cnt)+':'+str(a1)+"?"+str(a2)+"\n");

20 ans=False;

21 cnt=cnt+1;

22 if ans:

23 f3.write("All Good!");

24 print("All Good!");

25 else:

26 print("Not Good!There're "+str(tot)+" Wrongs!You Must Check Your Program!");

27 f1.close();

28 f2.close();

29 f3.close();

30 os.system("pause");

31 f1.close();

32 f2.close();

33 f3.close();

以上是 python对拍程序 的全部内容, 来源链接: utcz.com/z/387742.html

回到顶部