摘要:打什么打,我们都是绅士...........-----------------------------------------------------------------------------------------------------2013 杭州:比赛过程见:2013 年亚洲赛杭州赛区卡题总结1、秒水题。2、一个小时搞出一题。3、焕神卡A题卡到死。4、秒博弈DP。。5、铜牌滚粗。------------------------------------------------------------------------------------------------------
阅读全文
摘要:int __builtin_ffs (unsigned int x)返回x的最后一位1的是从后向前第几位,比如7368(1110011001000)返回4。int __builtin_clz (unsigned int x)返回前导的0的个数。int __builtin_ctz (unsigned int x)返回后面的0个个数,和__builtin_clz相对。int __builtin_popcount (unsigned int x)返回二进制表示中1的个数。int __builtin_parity (unsigned int x)返回x的奇偶校验位,也就是x的1的个数模2的结果。此外,
阅读全文
摘要:-----------------103. Traffic LightsTime limit per test: 0.5 second(s)Memory limit: 4096 kilobytesinput: standardoutput: standardIn the city of Dingilville the traffic is arranged in an unusual way. There are junctions and roads connecting the junctions. There is at most one road between any two dif
阅读全文
摘要:104. Little shop of flowerstime limit per test: 0.5 sec.memory limit per test: 4096 KBPROBLEMYou want to arrange the window of your flower shop in a most pleasant way. You haveFbunches of flowers, each being of a different kind, and at least as many vases ordered in a row. The vases are glued onto t
阅读全文
摘要:101. Dominotime limit per test: 0.5 sec.memory limit per test: 4096 KBDominoes – game played with small, rectangular blocks of wood or other material, each identified by a number of dots, or pips, on its face. The blocks usually are called bones, dominoes, or pieces and sometimes men, stones, or eve
阅读全文
摘要:挖坑------------------------------------------------------------------------------------------------------------
阅读全文
摘要:-----------------A string is finite sequence of characters over a non-empty finite set Σ.In this problem, Σ is the set of lowercase letters.Substring, also called factor, is a consecutive sequence of characters occurrences at least once in a string.Now your task is simple, for two given strings, fin
阅读全文
摘要:-------------ReincarnationTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 1439Accepted Submission(s): 503Problem DescriptionNow you are back,and have a task to do:Given you a string s consist of lower-case English letters only,denote f(s) as the n
阅读全文
摘要:挖坑-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
阅读全文
摘要:挖坑--------------------------一 序列调整hdu 3434 Sequence Adjustment题目大意:给你含有n个数的序列,每次你可以选一个子序列将上面所有的数字加1或者减1,目标是把所有数字变成相同的,问最少步数,和那个相同的数字有多少种可能。对序列中的相邻元素做差,假设元素i之前的序列已经相等,此时序列值为sum。#include #include #include #include using namespace std;const int maxn=1111111;typedef long long LL;int a[maxn];LL b[maxn],p
阅读全文
摘要:一 状压搜索SGU 527 Explode 'Em All枚举攻击哪一行,将未被消灭的列记录下来,若小于行数,则记录下答案。#include #include #include #include using namespace std;const int maxs=1=col[set]&&row>n>>m; for (int i=0;i>map[i][j]; if (map[i][j]=='*') bit[i]|=(1>1)]+(i&1); dfs(0,0,0); cout<<ans<<end
阅读全文
摘要:挖坑-------------------------------一 数位DPPOJ 3208 Apocalypse Someday#include #include #include using namespace std;typedef long long LL;int s[4][10];LL a[15][4];void init(){ memset(s,0,sizeof(s)); s[0][6]=1; s[1][6]=2; s[2][6]=3; for(int i=0;in){ len=i; bre...
阅读全文
摘要:挖坑------------------------一 构造矩阵SGU 409 BerlandFlag构造在一个边长为n*n(也就是说面积为n*n*n*n的)正方形。正方形中只包含' * '和' . '。满足:使得将这个正方形分隔成n*n个大小为n*n的正方形之后,每个小正方形里都刚好有k个 ' * '每行每列都刚好只有k个' * '。[solution]根据样例推理构造。#include #include using namespace std;const int maxn=1005;int n,m;bool a[maxn][m
阅读全文
摘要:--------------一 MSTDPPOJ 3538 Domestic Networks有n个点m条边,和5型6型两种线,每米花费p5、p6,各有q5、q6米。每条边要么用5型连接要么用6型,或不连接。求将n个点连接的最小花费。与最小花费的方案。首先求出最小生成树。在对树上的边进行dp。f[ i ][ j ] 表示 前i条路用5型j米的最小花费。f[i][j]=f[i-1][j]+c*p6 (第i条路不使用5型)f[i][j]=f[i-1][j-c]+c*p5 (第i条路使用5型)#include #include #include #include #include #define r
阅读全文
摘要:挖坑..---------------------------一 生成子图POJ 2793 Cactus含有G的所有顶点的子图称为G的生成子图。问图是不是仙人掌树,若是仙人掌树,有多少生成子图。对于仙人掌树上的一个环,只删去一条边,仍是原图的生成子图。所以找到树上的每一个环,记录环上的点数,所有环上的点数相乘即是生成子图个数。数据较大要用高精度处理。#include #include #include #include #define fil(x) memset(x,0,sizeof(x))#define clr(x,a) memset(x,a,sizeof(x))using namespac
阅读全文
摘要:挖坑...--------------------------------一 小学奥数HDU 4103 Clock火星有A小时B分钟,一天有多少次分针超过时针θ呢。当然是A-1次啦。#include #include #include using namespace std;const double eps=1e-9;int main(){ int A,B; double t; while ((~scanf("%d%d%lf",&A,&B,&t))&&(A!=0||B!=0||fabs(t)>eps)){ printf(&quo
阅读全文
摘要:挖坑------------------一 小学贪心HDU 3552 I can do it!题目大意:一个元素分为2个属性,a和b。然后将元素分成2个集合A和B。求出"A集合的a属性的最大值+B集合的b属性的最大值"的最小值 解题思路:一篇很详细的结题报告http://blog.csdn.net/dgq8211/article/details/7748078#include #include #include #include using namespace std;const int maxn=111111;const int INF=0x3f3f3f3f;struct
阅读全文
摘要:挖坑...----------------------一 十字计数POJ 3467 Cross Counting由于颜色的总数=N,每一个电脑和端口的座标已知,现在要求把N个电脑分别连到N个端口上,一个端口最多连一台电脑,一台电脑要连一个端口。电脑与端口连接的代价是他们的座标值之差,问最小代价是多少。这个问题初看是一个完美匹配问题,但是由于点数比较多,无法用最小费用最大流解决----------------------三 论文RMQhttp://wenku.baidu.com/view/53e2b6ed4afe04a1b071deb5.html题目大意:论文题,查询一段区间内数字不重复的最长子
阅读全文
摘要:-----------------------------------------一 双向贪心POJ 3040 Allowance从大到小贪心选取一次,从小到大选取一次。缺少证明。。。#include #include #include #include using namespace std;const int maxn=41;const int INF=0x3f3f3f3f;typedef long long LL;typedef pair PII;PII a[maxn];int use[maxn];int n,c;int main(){ while (~scanf("%d%d&
阅读全文
摘要:-----------------------------一 矩阵相乘POJ 3213 PM 3给出三个矩阵A(NP)、B(PM)、C(NM) N,P,M#include #include #include #include using namespace std;typedef long long LL;const int maxn=1011;int N,P,M;int A[maxn][maxn],B[maxn][maxn];LL C[maxn][maxn];LL sumB[maxn],sumC[maxn];int wr,wl;LL rt;int main(){ while (~sca...
阅读全文
摘要:一 集合操作POJ 2443 Set Operation有1000个集合每个集合有10000个元素,给出每个集合所有的元素和Q组询问,问元素x和y是否属于同一个集合。手抽写了个集合类出来,效率低了。其实用元素开数组,压缩所属的集合效率更高。#include #include #include #include using namespace std;const int maxn=1111;typedef unsigned int uint;const int Size=30;class SetOperation{private: uint st[400]; int getIdx(i...
阅读全文