ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1846. GCD 2010

D4nick It will make test for you // Problem 1846. GCD 2010 5 Jun 2022 23:20
int make_test() {
    fstream inp("input2.txt", ios::out | ios::binary | ios::in | ios::trunc);
    if (!inp)
    {
        _Post_equals_last_error_ DWORD er = GetLastError();
        cerr << er << '\n';
        _getch();
        exit(1);
    }
    int n = 100;
    inp << n << '\n';
    srand(time(0));
    for (int i = 0; i < n; i++) {
        int sign = rand() % 2;
        if (sign == 1 || i < 2) {
            int a = rand() % 300;
            while (find(simple.begin(), simple.end(), a) != simple.end()) {
                a = rand() % 300;
            }
            inp << "+ " << a << '\n';
            v.push_back(a);
        }
        else if (v.size() > 1) {
            int a = rand() % v.size();
            inp << "- " << v[a] << '\n';
            v.erase(v.begin() + a);
        }
    }
    inp.close();
    return 0;
}