对拍程序

对拍的模板


duipai.cpp ↓↓↓

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    system("g++ rand.cpp -o rand");
    system("g++ my.cpp -o my");
    system("g++ std.cpp -o std");
    //编译三个cpp文件
    for(ll i=1;;i++)
    {
        cout<<"num:"<<i<<'\n';
        system("./rand");
        system("./my");
        system("./std");
        //运行三个cpp文件
        if(system("diff my.out std.out"))//比较两个文件的输出是否一致
        {
            cout<<"wrong!"<<'\n';
            break;
        }
        else
            cout<<"right!"<<'\n';
    }
    return 0;
}

rand.cpp ↓↓↓

#include<bits/stdc++.h>
using namespace std;
#define ll long long
random_device you;
mt19937 pyt(you());
ll rd(ll l,ll r)
{
    uniform_int_distribution<> ee(l,r);
    return ee(pyt);
}
//物理随机,比srand更加可靠
int main()
{
    freopen("in.in","w",stdout);
    srand(time(0));
    ll n=rd(1,1000);//示例
    /*
        你的数据生成代码
    */
    return 0;
}
posted @ 2025-11-15 15:29  Guojunning  阅读(4)  评论(0)    收藏  举报