上一页 1 2 3 4 5 6 7 ··· 20 下一页

2015年3月16日

Poj1222EXTENDED LIGHTS OUT高斯消元

摘要: 题意:1表示开着,0表示关着。当对某个等打开或关闭时,周围四个灯的状态也会改变,让输出一种开关灯的方式。搞法1:高斯消元,不过感觉数据应该有问题,我解方程是按一定会存在唯一一组解的情况写的。#include #include #include #include #include #include #... 阅读全文

posted @ 2015-03-16 20:05 一个西瓜 阅读(139) 评论(0) 推荐(0)

2015年3月15日

Hash小结

摘要: Poj1480Eqsa1x13+ a2x23+ a3x33+ a4x43+ a5x53=0 ->a1x13+ a2x23+ a3x3=-(a4x43+ a5x53 问有多少个满足等式的非零x1,x2,x3,x4,x5组。)中途相遇法,枚举x1,x2,x3得到左边式子的值插入hash表,然后枚举x4,... 阅读全文

posted @ 2015-03-15 17:39 一个西瓜 阅读(194) 评论(0) 推荐(0)

字符串hash模板

摘要: int BKDRHash(char *str){ int seed = 131; int hash = 0; while (*str) hash = hash * seed + (*str++); return (hash & 0x7FFFFFFF) % MAXN;}str... 阅读全文

posted @ 2015-03-15 17:05 一个西瓜 阅读(193) 评论(0) 推荐(1)

快速幂&快速乘

摘要: LL mult_mod(LL a, LL b, LL c){ a %= c; b %= c; LL ret = 0; LL tmp = a; while (b){ if (b & 1){ ret += tmp; if... 阅读全文

posted @ 2015-03-15 17:04 一个西瓜 阅读(148) 评论(0) 推荐(0)

2015年1月24日

Codeforces Round #287 (Div. 2)C. Guess Your Way Out!

摘要: Amr bought a new video game "Guess Your Way Out!". The goal of the game is to find an exit from the maze that looks like a perfect binary tree of heig... 阅读全文

posted @ 2015-01-24 08:05 一个西瓜 阅读(281) 评论(0) 推荐(0)

2014年12月21日

exgcd&gcd模板

摘要: //返回d=gcd(a,b);和对应于等式ax+by=d中的x,ylong long extend_gcd(long long a,long long b,long long &x,long long &y){ if(a==0&&b==0) return -1;//无最大公约数 if(b... 阅读全文

posted @ 2014-12-21 21:53 一个西瓜 阅读(276) 评论(0) 推荐(0)

Hdu5145NPY and girls莫队算法

摘要: Problem DescriptionNPY's girlfriend blew him out!His honey doesn't love him any more!However, he has so many girlfriend candidates.Because there are t... 阅读全文

posted @ 2014-12-21 21:40 一个西瓜 阅读(351) 评论(0) 推荐(0)

2014年12月18日

Codeforces Round #283 (Div. 2)D. Tennis Game

摘要: Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consi... 阅读全文

posted @ 2014-12-18 04:03 一个西瓜 阅读(331) 评论(0) 推荐(0)

2014年12月14日

Poj2155Matrix二维线段树

摘要: 题意: c表示矩阵内01 互换,q表示单点查询。#include#include#include#includeusing namespace std;const int maxn = 1000+5;#define lson l,mid,rt>1; inbuild(root,lson); ... 阅读全文

posted @ 2014-12-14 16:05 一个西瓜 阅读(130) 评论(0) 推荐(0)

二维树状数组模板

摘要: #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;const int MAX=1200;int... 阅读全文

posted @ 2014-12-14 16:03 一个西瓜 阅读(167) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 ··· 20 下一页

导航