码迷,mamicode.com
首页 >  
搜索关键字:bzoj    ( 10801个结果
bzoj 2120: 数颜色 线段树套平衡树
/************************************************************** Problem: 2120 User: wangyucheng Language: C++ Result: Time_Limit_Exceed***...
分类:其他好文   时间:2014-07-19 19:26:18    阅读次数:225
BZOJ 1874 取石子游戏 (NIM游戏)
题解:简单的NIM游戏,直接计算SG函数,至于找先手策略则按字典序异或掉,去除石子后再异或判断,若可行则直接输出。#include const int N=1005;int SG[N],b[N],hash[N],a[N],sum,tmp,i,j,n,m; void FSG(int s){ ...
分类:其他好文   时间:2014-07-18 21:09:31    阅读次数:206
BZOJ 1008 越狱 (组合数学)
题解:正难则反,从总数中减去全部相邻不相同的数目就是答案,n*(n-1)^(m-1):第一个房间有n中染色方案,剩下m-1个房间均只有n-1种染色方案,用总数减就是答案。#include const int mod=100003; typedef long long LL; LL n,m; LL p...
分类:其他好文   时间:2014-07-18 20:20:40    阅读次数:212
BZOJ 1005 明明的烦恼 (组合数学)
题解:n为树的节点数,d[ ]为各节点的度数,m为无限制度数的节点数。则所以要求在n-2大小的数组中插入tot各序号,共有种插法;在tot各序号排列中,插第一个节点的方法有种插法;插第二个节点的方法有种插法; .........另外还有m各节点无度数限制,所以它们可任意排列在剩余的n-2-tot的空...
分类:其他好文   时间:2014-07-18 08:06:12    阅读次数:324
BZOJ 2243: [SDOI2011]染色 树链剖分
2243: [SDOI2011]染色Time Limit: 20 SecMemory Limit: 512 MBSubmit: 1886Solved: 752[Submit][Status]Description给定一棵有n个节点的无根树和m个操作,操作有2类:1、将节点a到节点b路径上所有点都染成...
分类:其他好文   时间:2014-07-17 22:08:09    阅读次数:553
BZOJ 1058 报表统计 (STL)
题解:数据结构的基本操作,用STL可以完美实现,就是比较慢……#include #include #include #include #include const int MAXN=500005; const int INF=~0U>>1; using namespace std; ...
分类:其他好文   时间:2014-07-17 17:39:20    阅读次数:193
BZOJ 1022 小约翰的游戏 (Anti-Nim游戏)
题解:注意题目中规定取到最后一粒石子的人算输,所以是Anti-Nim游戏,胜负判断为:先手必胜: 1.所有堆的石子数都为1且游戏的SG值为0; 2.有些堆的石子数大于1且游戏的SG值不为0。#include int main(){ int t,n,s,x,tmp; scanf("%d...
分类:其他好文   时间:2014-07-17 11:09:17    阅读次数:303
BZOJ 2761 不重复数字 (Hash)
题解:直接使用STL中的hash去重即可#include #include using namespace std;int ans[50010];int main(){ int T,n,tmp; scanf("%d",&T); while(T--){ int cnt=...
分类:其他好文   时间:2014-07-17 10:02:58    阅读次数:231
BZOJ 2463 谁能赢呢? (博弈论)
题解:简单博弈论#include int main(){ int n; while(scanf("%d",&n),n!=0) if (n&1) puts("Bob"); else puts("Alice"); return 0;}
分类:其他好文   时间:2014-07-17 10:01:29    阅读次数:259
BZOJ 1192 鬼谷子的钱袋 (二进制思想)
题解:鉴于二进制的思想来划分#include int main(){ int n,d=0;scanf("%d",&n); while(1<<d<=n)d++; printf("%d\n",d);}
分类:其他好文   时间:2014-07-17 09:58:59    阅读次数:197
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!