前情提要:某模拟赛的下发文件中每题都有20个样例。不小心把数据发下来了
于是场上码了一个程序测试:
#include<bits/stdc++.h>
using namespace std;
vector<string>ids={"1","2","3","4","5","6","7","8"};//测试点编号
string nm="move";//文件名,没开文件读写
int main(){
system(("g++ "+nm+".cpp -o my -O2 -std=c++14 -Wl,--stack=1234567890").c_str());
for(string id:ids){
double t1=clock();
system(("my<"+nm+id+".in>my.out").c_str());
double t2=clock();
if(system(("fc "+nm+id+".ans my.out").c_str())){
cout<<"error on testcase "<<id<<endl;
system("pause");
}
else{
printf("ok using %.3lfs\n\n",(t2-t1)/CLOCKS_PER_SEC);
}
}
return 0;
}写的比较急,没用 itoa ,也没判 TLE 等情况,不过应该够用了。