1 #include<bits/stdc++.h> 2 using namespace std; 3 #define _DO_CMDS(cmds) for(int _index=0;_index<sizeof(cmds)/4;++_index){system((cmds[(_index)]));} 4 char *build[]{ 5 "g++ -o test test.cpp", 6 "g++ -o rand rand.cpp -O2", 7 "g++ -o std std.cpp -O2" 8 }; 9 char *randata[]{ 10 "./rand > a.in", 11 "./std < a.in > a.ans" 12 }; 13 int main() 14 { 15 _DO_CMDS(build); 16 int runtime=100; 17 for(int i=1;i<=runtime;++i) 18 { 19 DO_CNMD(randata); 20 printf("Case %d:"i); 21 if(system("./test < a.in > a.out")!=0) 22 {cout<<"RE"<<endl;break;} 23 else if(system("diff -b a.out a.ans")) 24 {cout<<"WA"<<endl;break;} 25 else cout<<"AC"<<endl; 26 } 27 return 0; 28 }
原文:https://www.cnblogs.com/qwerta/p/9413228.html