偶尔写写ACM水题还是挺好玩的。(好吧其实是老婆求助我才看滴) 题目链接:http://acm.hdu.edu.cn/showproblem.

今天心情好,刷了两到ACM水题,思路很简单都在注释里,所以直接贴代码: /** * @file 龟兔赛跑.cpp * @brief 龟兔赛跑 AC代码 (DP) * DP方程式: [到第i的充

某个课程的作业,促使我来看看这玩意。 整个程序的算法思想是看别人的ACM的blog看懂的,感觉确实和KMP很像。但是代码呢就比较工程化一点。顺

最初是接受了lpld的邀请来写这篇大总结。我没有LHH华丽的文笔,就只能随便写写了。回想起来,ACM应该是我在大学期间参加的最有意义并且收获

好久没写这种类型的代码,感觉真是退步了很多。 这是我第一次参加Google Code Jam,以前有过报名可是没有做过。 我发现Google Code Jam的题目

/** * 二维ACM计算几何模板 * 注意变量类型更改和EPS * #include <cmath> * #include <cstdio> * By OWenT */ const double eps = 1e-8; const double pi = std::acos(-1.0); //点 class point { public: double x, y; point(){}; point(double x, double y):x(x),y(y){}; static int xmult(const point &ps, const point &pe, const

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) 一个栈(

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

基础函数: // 最大公约数,欧几里得定理 int gcd(int a, int b) { return b?gcd(b, a % b): a; } // 拓展欧几里得定理 // 求解ax + by = gcd(a,b) int ext_gcd(int a, int b, int &x, int &y) { int tmp, ret; if(!b) { x = 1; y = 0;

题目链接: http://acm.pku.edu.cn/JudgeOnline/problem?id=2826 大致意思是给你两条线段,问组成的开口向上的V形区域能盛多少雨水。雨水是垂直落下的。 显然线段不相交,或者平行,重合,或者有一条斜率

int a = 12345678; //格式为sring输出 Label1.Text = string.Format("asdfadsf{0}adsfasdf",a); Label2.Text = "asdfadsf"+a.ToString()+"adsfasdf"; Label1.Text = string.Format("asdfadsf{0:C}adsfasdf"