简易测评机+生成器

· · 个人记录

测评机

#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
int main()
{
    for(int t=1;t<=5;t++){
        printf("No:%d ",t);
        string id=to_string(t);
        string title="and"+id;
        string cmd1="and.exe <"+title+".in >"+title+".out";
        string cmd2="fc "+title+".out"+title+".ans";
        system(cmd1.c_str());
        if(system(cmd2.c_str())){
            puts("听取WA声一片");
        }
        else cout<<"恭喜你,你又AC了一测试点"<<endl;
    }
    return 0;
}

生成器

#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
int random(int n) {
    return (long long) rand() * rand() % n; //生成0~10的9次方的随机数
}
string todo, xdo;
int main() {
    int n;
    cin>>n;
    for (int i = 1; i <= n; i++) {
        srand(time(0));
        int n = 1e9 + 1;
        int t1, s1, x1;
        t1 = random(n);
        while (true) {
            s1 = random(n);
            if (2 <= s1) break; //保证>=2
        }
        x1 = random(n);
        if (t1 == x1) {
            todo = "NO";
            return 0;
        }
        for (int i = t1 + s1;  ; i += s1) {
            if (i == x1 || i + 1 == x1) {
                todo = "YES";
            }
            if (i > x1) break;
        }
        todo = "NO";
        if (x1 == t1)   xdo = "YES"; //如果x刚好等于t时刻直接就给怒吼
        else {
            if ((x1 - t1) % s1 == 0 && (x1 - t1) != 0 || (x1 - t1 - 1) % s1 == 0 && (x1 - t1 - 1) != 0)    xdo = "YES";
            else    xdo = "NO";
        }
        if (xdo == todo) {
            cout << "ACACACACACACACACACACACACACACACACACAC" <<" "<<t1<<" "<<s1<<" "<<x1<<" "<<todo<<" "<<xdo<< endl << endl;
        } else {
            cout << "WAWAWAWAWAWAWAWAWAWAWAWAWAWAWAWAWAWAWAWAWAWAWAWAWAWAWAWAWAWAWAWAWAWA" <<" "<<t1<<" "<<s1<<" "<<x1<<" "<<todo<<" "<<xdo<< endl << endl;
        }
        Sleep(1000);
    }
    return 0;
}