跳到正文

个人记录

【模板】对拍

houmy约 1 分钟
原文
文章信息与版本

文章信息

发布
2022年6月28日
收录
2026年3月12日
更新
2026年10月29日
篇幅
约 1 分钟

版本

  1. v1当前
C++
#include<iostream>
#include<fstream>
#include<windows.h>
using namespace std;
void genData(){
    ofstream dtout("dat.txt");
    //Put your data-generating code here
}
int i=1;
int main(){
    system("@echo off");
    cout<<"Compiling..."<<endl;
    system("g++.exe -o 1.exe 1.cpp");
    system("g++.exe -o 2.exe 2.cpp");
    cout<<"Testing..."<<endl;
    while(true){
        genData();
        system("1.exe < dat.txt > 1.txt");
        system("2.exe < dat.txt > 2.txt");
        if(system("fc 1.txt 2.txt")){
            cout<<"Data #"<<i<<" WA"<<endl;
            system("pause");
            break;
        }else{
            cout<<"Data #"<<i<<" AC"<<endl;
        }
    }
}
原文