首页 > 其他分享 >对拍器

对拍器

时间:2024-06-13 20:45:15浏览次数:9  
标签:input2 10 input1 cout int 拍器

对拍器代码

#include <fstream>

void solve() {
    ifstream input1;
    // 你的代码运行的输出
    input1.open("../output.txt");
    ifstream input2;
    // 正确的代码的输出
    input2.open("../compare/output.txt");
    int n = 10, m = 10;
    int T = 10;
    for (int t = 1; t <= T; t ++) {
        for (int i = 1; i <= n + m + 1; i ++) {
            int x, y;
            input1 >> x;
            input2 >> y;
            if (x != y) {
                cout << "WA on test" << t << " on " << i << '\n';
            }
        }
        cout << "AC on test" << t << '\n';
    }
}

随机数据生成

#include <random>

mt19937_64 rnd(1064);
int rd(int l, int r) {return rnd() % (r - l + 1) + l;}

int a[100];

void solve() {
    int t = 10;
    cout << t << '\n';
    while (t --) {
        int n = 10, m = 10;
        cout << n << ' ' << m << '\n';
        for (int i = 1; i <= n + m + 1; i ++) {
            a[i] = rd(1, 100);
            cout << a[i] << ' ';
        }
        cout << '\n';
        for (int i = 1; i <= n + m + 1; i ++) {
            int x = rd(1, 100);
            while (x == a[i]) x = rd(1, 100);
            cout << x << ' ';
        }
        cout << '\n';
    }
}

以上代码均需要针对不同问题做修改。

标签:input2,10,input1,cout,int,拍器
From: https://www.cnblogs.com/lightmon5210/p/18246709

相关文章

  • 数据对拍器简单介绍
    文章目录数据对拍举例dp暴力数据对拍总结数据对拍使用数据对拍的功能来检测代码有没有出错误。步骤:针对某个题的做题过程首先写这道题的你认为的优化做法,因为一般的算法竞赛中肯定不可能是暴力的。然后写这道题的暴力做法。然后写数据对拍器,比较数据的差异举例2.01背包问题dp对于......
  • 手机节拍器
    手机节拍器隐私政策更新时间:2022年9月生效时间:2021年8月广州瑾讯计算机系统有限公司非常注重保护用户(“您”)的个人信息及隐私,我们深知个人信息对您的重要性,并将按照法律法......