对拍

    需要四个程序, 分别是 random.cpp, sol.cpp, bf.cpp, pai.cpp 

random.cpp

#include <bits/stdc++.h>
#include <ctime>
using namespace std;
typedef long long LL;
const LL INF = 0x3f3f3f3f3f3f3f3f;
const LL inf = 0x3f3f3f3f;

LL randrom(LL n)
{
    return (long long) rand() * rand() * rand() * rand() % n;
}

int main()
{
    freopen("data.in", "w", stdout);
    srand((unsigned)time(0));
    printf("%lld %lld\n", randrom(inf), randrom(inf));
    fclose(stdout);
    return 0;
}

 sol.cpp

 

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

int main()
{
    freopen("data.in", "r", stdin);
    freopen("data.out", "w", stdout);
    LL a, b; scanf("%lld %lld", &a, &b);
    printf("%lld\n", a + b);
    fclose(stdin);
    fclose(stdout);
    return 0;
}

bf.cpp

#include <bits/stdc++.h>
using namespace std;

int main()
{
    freopen("data.in", "r", stdin);
    freopen("data.ans", "w", stdout);
    int a, b; scanf("%d %d", &a, &b);
    printf("%d\n", a + b);
    fclose(stdin);
    fclose(stdout);
}

pai.cpp

#include <bits/stdc++.h>
#include <cstdlib>
#include <cstdio>
#include <ctime>
using namespace std;

void print(FILE *f)
{
    char ch = fgetc(f);
    while(ch != EOF){
        printf("%c", ch);
        ch = fgetc(f);
    }
}

int main()
{
    for(int T = 1; T <= 10000; T++){
        system("random.exe");
        double st = clock();
        system("sol.exe");
        double et = clock();
        system("bf.exe");
        int flag = system("fc data.out data.ans");
        if(flag)
            puts("Wrong Answer");
        else 
            printf("Accepted, Points: #%d, Time: %.0fms\n", T, et - st);
        FILE *f1 = fopen("data.in", "r");
        FILE *f2 = fopen("data.out", "r");
        FILE *f3 = fopen("data.ans", "r");
        puts("Input"); print(f1);
        puts("Output_sol"); print(f2);
        puts("Output_bf"); print(f3);
        if(flag) break;
    }
    fclose(stdin);
    fclose(stdout);
    return 0;
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值