Skip to content

Files

Latest commit

author
aoapc-book
Jul 13, 2014
f1d4608 · Jul 13, 2014

History

History

ch7

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jun 17, 2014
Jun 17, 2014
Jun 17, 2014
Jun 17, 2014
Jun 17, 2014
Jun 17, 2014
Jun 17, 2014
Jun 17, 2014
Jun 17, 2014
Jun 17, 2014
Jun 29, 2014
Jun 29, 2014
Jun 17, 2014
Jun 30, 2014
Jun 29, 2014
Jul 12, 2014
Jun 17, 2014
Jul 13, 2014
Jul 2, 2014
Jul 13, 2014
Jun 17, 2014
Jun 17, 2014
Jun 17, 2014
Jun 17, 2014
Jun 17, 2014
Jun 17, 2014
Jun 17, 2014
Jun 17, 2014
Jun 17, 2014
Jun 17, 2014
Jun 17, 2014
Jul 13, 2014
Jun 17, 2014
Jun 17, 2014
Jun 17, 2014

《算法竞赛入门经典》第二版 范例代码

刘汝佳

第七章

基础知识代码

pp.cpp - 1~n的全排列

pp2.cpp - 可重集的全排列(递归)

pp3.cpp - 可重集的全排列(next_permutation)

subset.cpp - {0~n-1}的所有子集:增量构造法

subset2.cpp - {0~n-1}的所有子集:位向量法

subset3.cpp - {0~n-1}的所有子集:二进制法

nqueen_slow.cpp - n皇后问题:生成-测试法

nqueen.cpp - n皇后问题:普通回溯法

nqueen2.cpp - n皇后问题:优化的回溯法

8.cpp - 八数码,使用STL集合(最好写)

8b.cpp - 八数码,使用哈希表(竞赛中最常用)

8c.cpp - 八数码,使用全排列的编码/解码(最高效)

8a.in - 八数码,有解输入数据

8b.in - 八数码,无解输入数据

egypt.cpp - 埃及分数问题

例题代码

7-1 UVa725 Division

7-2 UVa11059 Maximum Product

7-3 UVa10976 Fractions Again?!

7-4 UVa524 Prime Ring Problem

7-5 UVa129 Krypton Factor

7-6 UVa140 Bandwidth

7-7 UVa1354 Mobile Computing

7-8 UVa10603 Fill

7-9 UVa1601 The Morning after Halloween

7-10 UVa11212 Editing a Book

7-11 UVa12325 Zombie's Treasure Chest

7-12 UVa1343 The Rotation Game

7-13 UVa1374 Power Calculus

7-14 UVa1602 Lattice Animals

7-15 UVa1603 Square Destroyer