关于差分约束(转载) (本文假设读者已经有以下知识:最短路径的基本性质、Bellman-Ford算法。) 比如有这样一组不等式: $$ \begin{cases} X1 - X2 <= 0 \\

一、引言 计算机的出现使得很多原本十分繁琐的工作得以大幅度简化,但是也有一些在人们直观看来很容易的问题却需要拿出一套并不简单的通用解决方案,比

好久不写代码,省赛之后一直在赶作业和复习。对自己还真没什么信心 话说回来试了一下联系赛 三道水题,虽然钱两题很快,但是竟然多敲了几个没用的字符导

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"

树状数组模块 ACM个人模板 POJ 2155 题目测试通过 /** * 树状数组模块 * 下标从0开始 */ typedef long DG_Ran; typedef long DG_Num; const DG_Num DG_MAXN = 1005; //2^n DG_Num LowBit(DG_Num n) { return n & (-n); } //获取父节点索引 DG_Num DGFather(DG_Num n)

/** * 线性筛法求素数表 * 复杂度: 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(!

又是我们的OJ 题目链接: http://www.cn210.com/onlinejudge/problemshow.php?pro_id=92 Description tancu likes space travels but he is a poor software developer and will never be able to buy his own spacecraft. That is why he is preparing to steal the spacecraft of Petru. There is only one problem - Petru has locked the spacecraft with a sophisticated cryptosystem based on the ID numbers of the stars

http://www.cn210.com/onlinejudge/problemshow.php?pro_id=98 我们的OJ Description &nbsp;</center> Input The next line contains the numbers of&nbsp;S:&nbsp;x1,&nbsp;x2, ...,&nbsp;xn.&nbsp; It is known that each&nbsp;xi&nbsp;is an integer, 0 &le;&nbsp;xi&nbsp;&le; 2*109.&nbsp; The input data set is correct and ends with an end of file.&nbsp;</div> Output &nbsp; Sample Input 2 1 2 3 1 3 9 4 1 2 3 6 Sample Output 1 12 4 首先由于行列式交换

题目链接: http://acm.pku.edu.cn/JudgeOnline/problem?id=2976 0-1分数规划 最优比例生成树 迭代法 证明:(前几次都是看别人的,这次自己证明) 对于集合s,令l* = max{ a(x) / b(x) } = a(x*) / b(x*).l*

链接: http://acm.pku.edu.cn/JudgeOnline/problem?id=1141 题目意思是输入一些括号,补充括号使之成为没有错误的括号就是只能有括号组在括号组里面,不能出现([)]或者([)]一类的情况 方法是DP

这道题是我专门为了了解和学习树状数组而写的 这题用树状数组记录翻转次数,然后mod一个2,也可以不断地取反 还要用到二维的树状数组.于是我专门写