1. 程式人生 > >C++對拍(cmd)

C++對拍(cmd)

C++對拍程式**!不是bat批處理**

#include<cstdio>
#include<cstdlib>
#include<ctime>
using namespace std;

int main()
{
    for (int i=1;i<=100000;i++)
    {
        system("C:\\random.exe");
        double st=clock();
        system("C:\\sol.exe");
        double ed=clock();
        system
("C:\\bf.exe"); if (system("fc soldata.out bfdata.out")==0) { printf("Accepted, 測試點 #%d, 用時 %.0lfms\n",i,ed-st); } else { printf("Wrong Answer"); return 0; } } return 0; }

隨機函式

#include<cstdio>
#include<ctime>
using namespace std; int main() { srand((unsigned)time(NULL)); int n=rand();