跳到正文

剪贴板

剪贴板 jpgloklv

原文
剪贴板信息

剪贴板信息

收录
更新
C++
namespace IO {
	template <typename T> inline void read(T &in) {
		in = 0; int fh = 1; char ch = getchar();
		while(! isdigit(ch)){
			if(ch == '-') fh = -1;
			ch = getchar();
		}
		while(isdigit(ch)) in = (in << 1) + (in << 3) + (ch ^ 48), ch = getchar();
		in *= fh;
	}
	template <typename T> inline void write(T out) {
		static char op[25]; int top = 0;
		if(out < 0) putchar('-'), out = -out;
		do{op[++ top] = out % 10 + 48, out /= 10;} while(out);
		while(top) putchar(op[top --]);
		putchar('\n');
	}
	template <typename T, typename... Ts> inline void read(T &in, Ts&... ins) {read(in), read(ins...);}
	template <typename T, typename... Ts> inline void write(T out, Ts... outs) {write(out), write(outs...);}
}
using namespace IO;
C++
namespace Math {
	inline int exgcd(int a, int b, int &x, int &y) {
		if(! b) {
			x = 1, y = 0;
			return a;
		}
		int d = exgcd(b, a % b, x, y), t = x;
		x = y, y = t - (a / b) * y;
		return d;
	}

	inline int qpow(int base, int k) {
		int res = 1;

		while(k) {
			if(k & 1) res = res * base % p;

			base = base * base % p, k >>= 1;
		}

		return res;
	}

	int C(int n, int m) {
	    if(m > n) return 0;
	    return ((fac[n] * qpow(fac[m], mod - 2, mod)) % mod * pow(fac[n - m], mod - 2, mod) % mod);
	}

	int Lucas(int n, int m) {
	    if(! m) return 1;

	    return C(n % mod,m % mod) * Lucas(n / mod,m / mod) % mod;
	}
}

图论工具

NOI 大纲

AT data

?

猫

chess

海螺场