[集合DP] UVA 10651 Pebble Solitaire
摘要:
根据题目描述,每次变换都减少了一个石子,所以只要求出初始状态最多可以变换多少次,用初始状态石子数目减去这个变换次数就得到最后剩余最少的石子的数目;最多有12位,用一个 int 表示状态,状态的转移可以用位运算实现。 1 /* 2 UVA 10651 - Pebble Solitaire 3 */ 4 # include <cstdio> 5 # include <cstring> 6 7 char s[20]; 8 int f[5000]; 9 10 bool move(int &x, int i, char d)11 {12 int t = (x>> 阅读全文
posted @ 2012-08-03 17:01 getgoing 阅读(317) 评论(0) 推荐(0) 编辑