2012年7月18日

poj 3274 Gold Balanced Lineup

摘要: 这题真的没有想到可以用HASH,对HASH又有了新的理解.算法:1.二分枚举,TLEView Code #include<stdio.h>#include<string.h>#include<stdlib.h>#include<iostream>#include<algorithm>#include<map>#include<math.h>using namespace std;int N, k;struct node{ int bit[40];}tx[101000];int sum[40];int jugde 阅读全文

posted @ 2012-07-18 17:44 more think, more gains 阅读(147) 评论(0) 推荐(0) 编辑

poj 3349 Snowflake Snow Snowflakes

摘要: 用了三种算法:第一种算法:相当暴力,用map保存所有可能得雪花,果断TLE。第二种算法:HASH, 采用拉链法处理冲突,数据结构静态链表,hash方法为雪花六个点和,相邻点之差。AC第三种算法:HASH,sum为各雪花异或再加上相邻点之差。再根据sum从小到大排序。AC第二种算法代码:View Code #include<stdio.h>#include<string.h>#include<stdlib.h>#include<iostream>using namespace std;#define MAXN 1440000#define MOD 阅读全文

posted @ 2012-07-18 11:12 more think, more gains 阅读(136) 评论(0) 推荐(0) 编辑

导航