学习

· · 个人记录

主函数

#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
const int INF = 2147483647;
const int N = 1e0 + 10;
int main()
{
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(0);

    return 0;
}

快读

int read()
{
    int p = 0, w = 1;
    char ch = getchar();
    while(ch < '0' || ch > '9') {if(ch == '-') w = -1; ch = getchar();}
    while(ch >= '0' && ch <= '9') p = p * 10 + (ch ^ 48), ch = getchar();
    return p * w;
}

对拍

随机函数

#include <ctime>
srand(time(0));
int i = rand();

对拍程序

#include <iostream>
#include <ctime>
using namespace std;
int main()
{
    int n = 100;
    for(int i = 1; i <= n; i++)
    {
        system("data.exe > data.txt");
        system("std.exe < data.txt > std.txt");
        double begin = clock();
        system("test.exe < data.txt > test.txt");
        double end = clock();
        if(system("fc test.txt std.txt")) return puts("Wrong answer"), 0;
//      else printf("Accepted  #%d  %.0lfms\n", i, end - begin);
    }
    return 0;
}