一些工具

运行

g++ -o a a.cpp && ./a
g++  b.cpp -o b && ./b
g++  c.cpp -o c && ./c

freopen

	#ifndef ONLINE_JUDGE
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
    #endif

快读

template<typename Tp> inline void read(Tp&x)
{
    x=0;register bool z=1;
    register char c=getchar();
    for(;c<'0'||c>'9';c=getchar()) if(c=='-') z=0;
    for(;'0'<=c&&c<='9';c=getchar()) x=(x<<1)+(x<<3)+(c^48);
    x=(z?x:~x+1);
}

快写

void wt(int x){if(x>9)wt(x/10);putchar((x%10)+'0');}
void write(int x){if(x<0)putchar('-'),x=~x+1;wt(x);}

(解绑cin、cout)

	std::ios::sync_with_stdio(false);
	std::cin.tie(0);std::cout.tie(0);

模板

#include<bits/stdc++.h>
#define int long long 
#define endl '\n'
using namespace std;
const int N=1e6+10,P=1e9+7;
void array_space();
template<typename Tp> inline void read(Tp&x)
{
    x=0;register bool z=true;
    register char c=getchar();
    for(;c<'0'||c>'9';c=getchar()) if(c=='-') z=0;
    for(;'0'<=c&&c<='9';c=getchar()) x=(x<<1)+(x<<3)+(c^48);
    x=(z?x:~x+1);
}
signed main()
{
	#ifndef ONLINE_JUDGE
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
    #endif
}
void array_space() {cerr<<(sizeof(a))/1024./1024<<endl;}

文本比对

#include<bits/stdc++.h>
using namespace std;
signed main()
{
    freopen("compera.txt","w",stdout);
    if(!system("diff out.txt charlie_.txt")) puts("AC");
    else puts("WA");
}

计算数组空间大小

void array_space() {cerr<<(sizeof(a))/1024./1024<<endl;}
posted @ 2024-07-11 15:17  卡布叻_周深  阅读(61)  评论(3编辑  收藏  举报