如果不知道哪里错了
查看原帖
如果不知道哪里错了
1281794
postpone楼主2025/1/23 04:10

我写了个对拍的,输出的第一行是题目输入,第二行是答案,可以拍几组检查一下。

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

int main() {
    cin.tie(nullptr)
        ->sync_with_stdio(false);

    mt19937_64 rng{chrono::steady_clock::now().time_since_epoch().count()};

    constexpr int N = 1e9;

    int a = rng() % N;
    int b = rng() % N;

    int c = rng() % 3;
    int d = rng() % 2;
    if (c == 0) {
        cout << a << "+-"[d] << b << "=?" << "\n";
        cout << (d ? a - b : a + b) << endl;
    } else if (c == 1) {
        cout << "?" << "+-"[d] << a << "=" << b << "\n";
        cout << (d ? b + a : b - a) << endl;
    } else {
        cout << a << "+-"[d] << "?=" << b << "\n";
        cout << (d ? a - b : b - a) << endl;
    }

    return 0;
}
2025/1/23 04:10
加载中...