C++对拍(cmd)

版权声明:请大家斧正,如喜欢的话,为拙见点一个赞吧。 https://blog.csdn.net/qq_39897867/article/details/83624910

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();

猜你喜欢

转载自blog.csdn.net/qq_39897867/article/details/83624910
今日推荐