# The 35th ACM/ICPC Asia Regional Tianjin Site —— Online Contest 1009 Convex 解题报告

The 35th ACM/ICPC Asia Regional Tianjin Site —— Online Contest 2010年天津赛 网络赛 I题 Convex 题目链接：http://acm.hdu.edu.cn/showproblem.php?pid

# Catalan 数

Catalan数: $$h(1)=1,h(0)=1$$ $$h(n)=\begin{cases} \sum_{i=0}^{n-1} h(i) \times h(n-i-1) & \text{if }(n>=2) \\ \frac{C(2n,n)}{n+1} & \text{if }(n=1,2,3,\mathellipsis) \end{cases}$$ 相关结论： n边形能分解成三角形的分法数为 h(n – 2) n个节点能组成的二叉树个数为 h(n) 一个栈(

# 简易四则运算(ACM个人模板)

/** * 简易四则运算（栈实现） * #include <stack> * #include <cstring> */ std::stack<char> opr; std::stack<double> num; char oprPRI; //初始化调用 void initCalc() { //优先级设置 char oprMap = { {'+', 1}, {'-', 1}, {'*', 2}, {'/', 2}, {'^', 3}, {'(', 100}, {')', 0} }; for(int i = 0; i < 7; i

# 线性筛法求质数(素数)表 及其原理

/** * 线性筛法求素数表 * 复杂度: O(n) */ const long MAXP = 1000000; long prime[MAXP] = {0},num_prime = 0; int isNotPrime[MAXP] = {1, 1}; void GetPrime_Init()//初始化调用 { for(long i = 2 ; i < MAXP ; i ++) { if(!

# GCD Determinant 解题报告

http://www.cn210.com/onlinejudge/problemshow.php?pro_id=98 我们的OJ Description We say that a set S = {x1, x2, ..., xn} is factor closed if for any xi ∈ S and any divisor d of xi we have d ∈ S. Let's build a GCD matrix (S) = (sij), wheresij = GCD(xi, xj) - the greatest common divisor of xi and xj. Given the factor closed set S, find the value of the determinant:    Input The input contains several test cases. Each test case starts with an integer n (0 < n < 1000), that stands for