判断1*2的砖块去填m*n的矩形总共的摆放方案dp[i][j]表示当前行状态为j时的总共的摆放方案先枚举上一层i的状态,如果存在某状态,就把还空的位置用竖的砖块插入,插满后,记录下当前i+1行的状态然后在i+1行暴力枚举所有可能摆放方案,这个状态数再叠加上同一行上一个的状态(没有摆放横砖块之前)总数最后的答案就是 dp[h][(1<<w)-1]即DP到最后一行,且摆满#include<stdio.h>#include<string.h>int h,w;__int64 dp[15][2050];void dfs2(int row,int state,int c Read More
posted @ 2012-03-25 21:59 Because Of You Views(853) Comments(0) Diggs(0) Edit
View Code #include<cstdio>#include<cstring>int hash[2000010];int main(){ int a,b,c,d,i,j; while(scanf("%d%d%d%d",&a,&b,&c,&d)!=EOF) { if( (a>0 && b>0 && c>0 && d>0 )|| (a<0 && b<0 && c<0 && d&l Read More
posted @ 2012-03-25 04:15 Because Of You Views(322) Comments(0) Diggs(0) Edit
第一次设计哈希函数,乱YY的,哈希函数细微的不同时间差距很大啊,我交了n遍。。。disscuss中的哈慈函数好强大。。x,y映射到一个哈希值,有可能会有多个值具有同一哈希值,所以建立邻接表,哈希函数的目的就是让尽量少的数拥有同一个哈希值也就是尽可能的分散,尽可能的做到一一映射,就做了这题我就感觉哈希好强大啊这是我看别人的代码后的理解,不知道对不对感觉是对的,因为能A题,呵呵。题目中已知两个点(相邻),可以求出正方形的另外两个点http://iaml.is-programmer.com/posts/7923.html已知两个点,可以得出得出另外两个点 (x1+|y1-y2|, y1+|x1-x2 Read More
posted @ 2012-03-25 03:42 Because Of You Views(404) Comments(0) Diggs(0) Edit
View Code const int maxn = 100000;const double eps = 1e-8;const double pi = acos(-1.0);#define sgn(x) (fabs(x)<eps?0:(x>0?1:-1))struct Point { double x, y; Point(double a=0,double b=0){x=a;y=b;} Point operator - (const Point& t) const { Point tmp; tmp.x = x - t.x; tmp... Read More
posted @ 2012-03-25 01:07 Because Of You Views(443) Comments(0) Diggs(0) Edit
主要内容是计算几何,利用了一个图论中的结论平面的区域个数 r=m-n+2,m为边数、n为点数心血来潮,决定不用别人的模板,手写了模板1:判断线段相交2:判断点在线段上都是些最基本的,不过这些以后就算我自己的啦,用别人的总感觉怪怪的View Code #include <cstdio>#include <cstring>#include <cmath>#include <algorithm>using namespace std;const int maxn = 100000;const double eps = 1e-8;const double Read More
posted @ 2012-03-25 00:57 Because Of You Views(300) Comments(0) Diggs(0) Edit