状态压缩
tomjobs
别慌,慌也没用
展开
-
Gym101612 Problem C. Consonant Fencity(状压枚举)
题意:要求你将一些种类字母变成大写,使得最后相邻且都为辅音,且大小写不同的字符对最多。思路:一开始的贪心想法是只要碰到相邻两个辅音,就把后面这个变成大写。但是题目要求是同一种类字符全部都得边,那就有后效性了。不过观察可得,嘿嘿,辅音一共19个,2^19,那不就是直接状压枚举了吗。#include<cmath>#include<cstdio>#include<cstring>#include<algorithm>#include<i.原创 2020-09-10 23:46:48 · 314 阅读 · 0 评论 -
Flip Game POJ - 1753(状态压缩)
Flip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the other one is black and each piece is lying either it’s bl...原创 2019-03-29 17:36:08 · 357 阅读 · 0 评论 -
拼三角形(csustoj2010)
拼三角形DescriptionCwolf9有n根木棍,他现在想将他们拼成一些三角形,问最多能拼成多少三角形,每根木棍只能用一次。Input多组输入每组数据第一行一个数 nn, (1 \leq n \leq 18)(1≤n≤18)。表示有n根木棍。接下来一行,nn个数记为a_iai 。表示第ii根木棍的长度为1\le a_i\le 1001≤ai ≤100Output...原创 2019-08-07 00:36:07 · 870 阅读 · 0 评论