2011年2月17日

ZOJ Problem Set - 1201 Inversion (Python)

摘要: ZOJ Problem Set - 1201Inversion Time Limit: 1 Second Memory Limit: 32768 KB Let { A1,A2,...,An } be a permutation of the set{ 1,2,..., n}. If i < j and Ai > Aj then the pair (Ai,Aj) is called an "inversion" of the permutation. For example, the permutation {3, 1, 4, 2} has three inversions: ( 阅读全文

posted @ 2011-02-17 13:56 天下之大 阅读(445) 评论(0) 推荐(0) 编辑

2010年7月2日

ZOJ Problem Set - 1016

摘要: Parencodings Time Limit: 1 Second Memory Limit: 32768 KB Let S = s1 s2 ... s2n be a well-formed string of parentheses. S can be encoded in two different ways:By an integer sequence P = p1 p2 ... pn ... 阅读全文

posted @ 2010-07-02 14:39 天下之大 阅读(184) 评论(0) 推荐(0) 编辑

2010年6月29日

关于弦图(ZOJ 1015)

摘要: 弦图是图论里面的概念。一个图被称作弦图时,它满足对于它的任意一个顶点数大于3的环,都至少有一条弦。这是ZOJ 1015中涉及的一个概念,至今无法理解。我的理解:这里提到的“环”应该是多边形的环吧,那弦就是连接不相邻节点的线段。既然划了线,那就等于把环切成两个环了,那剩下的两个环也都必须遵守这个规则吧。既然顶点大于3都要被切割,那索性全是三角形了?不知道我的理解哪里有问题,请... 阅读全文

posted @ 2010-06-29 15:12 天下之大 阅读(603) 评论(1) 推荐(0) 编辑

2010年6月23日

ZOJ Problem Set - 1005

摘要: Jugs Time Limit: 1 Second Memory Limit: 32768 KB Special Judge In the movie "Die Hard 3", Bruce Willis and Samuel L. Jackson were confronted with the following puzzle. They were given a 3-gallon jug... 阅读全文

posted @ 2010-06-23 22:31 天下之大 阅读(283) 评论(0) 推荐(0) 编辑

导航