gen/std

· · 个人记录

gen.cpp:

#include <bits/stdc++.h>
#include <windows.h>
#define int long long
using namespace std;
const int N = 2e6 + 10;
ifstream fin;
ofstream fout;
mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
int gint(int l,int r) {
    std::uniform_int_distribution<int> u(l, r);
    return u(rng);
}
double gdouble(double l,double r) {
    std::uniform_real_distribution<double> u(l, r);
    return u(rng);
}
void gen() {
    int a = gint(1,1e9),b = gint(1,1e9);
    //random_shuffle(v.begin(),v.end());
    assert(1 <= a && a <= 1e9);
    cout << a << " " << b << endl;
    //fout << a << " " << b << endl;
}
signed main () {
    srand(time(0));
    for(int i=1;i<=20;++i) {
        string s = to_string(i) + ".in";  //1.in 2.in
        fout.open(s); //
        gen();
        cout << "ok" << i << endl; 
        fout.close();
    }
    return 0;
} 

std:

#include<bits/stdc++.h>
#define int long long
using namespace std;
ifstream fin;
ofstream fout;
const int N = 1e5 + 10;
void check(int l,int x,int r) {
    assert(l <= x && x <= r);
}
void solve() {
    int n,m;
    fin >> n >> m;
    check(1,n,1e9);
    fout << ans << endl;
}
signed main() {
    for(int i=1;i<=20;++i) {
        string sin = to_string(i) + ".in";
        string sout = to_string(i) + ".out";
        fin.open(sin);
        fout.open(sout);
        solve();
        cout << "ok" << i << endl;
        fin.close();
        fout.close();
    }
}