标签:运行时 txt bit 运行时间 print namespace bat 没有 代码
好处:简单易写,不用开文件io
坏处:不能显示运行时间
ps:/W 是忽略空格和空行(一般评测的做法)
@echo off
:again
data>in.txt
std<in.txt>stdout.txt
test<in.txt>testout.txt
fc /W stdout.txt testout.txt >nul
if not errorlevel 1 goto again
pause建一个txt文件复制进去再改为bat文件,运行即可
我没用过因为比较麻烦而且效果并不让人满意
好处:能显示时间
坏处:麻烦,回显很让人不爽
把下面那种的前三行system只留下程序名(比如data)并且把fc中的>nul去掉
代码就不贴了
刚找到的
好处:不用开文件io并且没有回显
坏处:码量比第一种略大
主要就是把第一种的cmd语句搬过来再加上>nul取消回显
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long double s,t,t2;
    while(1)
    {
        system("data.exe > in.txt");
        s=clock();
        system("std.exe < in.txt  > stdout.txt");
        t=clock();
        system("test.exe < in.txt > testout.txt");
        t2=clock();
        if(system("fc /W stdout.txt testout.txt > nul"))
            break;
        else printf("AC time used: std %.2lfms test %.2lfms\n",t-s,t2-t);
    }
    printf("WA time used: std %.2lfms test %.2lfms\n",t-s,t2-t);
    system("pause>nul");
    return 0;
}标签:运行时 txt bit 运行时间 print namespace bat 没有 代码
原文地址:https://www.cnblogs.com/123789456ye/p/11026838.html