会员
周边
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
dy blog
大学喵
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
19
20
21
22
23
24
下一页
2015年10月13日
hdu5269 ZYB loves Xor I
摘要: 分治法和字典树都可以,都是递归,但字典树耗内存 从第一bit开始,若相同则xor为0,分到同一部分,不相同则统计,且此时lowbit为这一bit,最后结果要乘以2 1 /*分治法*/ 2 #include 3 #define MOD 998244353 4 5 using namespac...
阅读全文
posted @ 2015-10-13 19:36 cdongyang
阅读(173)
评论(0)
推荐(0)
2015年10月11日
UVA 11181 Probability|Given
摘要: 条件概率,r个人买东西的条件下第i个人买东西的概率P(Ai|B)。而P(Ai|B)=P(AiB)/P(B),其中P(AiB)表示事件Ai与事件B同时发生的概率,p(B)为B事件发生的概率 第一个样例 3 2 0.10 0.20 0.30 p(B)为两个人买东西的概率,p(AiB...
阅读全文
posted @ 2015-10-11 21:31 cdongyang
阅读(276)
评论(0)
推荐(0)
UVA 10277 Boastin' Red Socks
摘要: 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 unsigned int r,sum,p,q; 8 unsigned int st[50010][2]; 9 10 unsigned gcd(unsigned a,un...
阅读全文
posted @ 2015-10-11 16:43 cdongyang
阅读(175)
评论(0)
推荐(0)
2015年10月10日
CodeForces 566B Replicating Processes
摘要: 1 #include <bits/stdc++.h> 2 #define N 3010 3 #define LL long long 4 #define unsigned U 5 using namespace std; 6 int cas=1,T; 7 int n,a[N<<2],b[N<<2],
阅读全文
posted @ 2015-10-10 18:44 cdongyang
阅读(277)
评论(0)
推荐(0)
2015年10月9日
UVA 10714 Ants
摘要: 贪心,蚂蚁间的掉头相当于穿过,所以以中间为区分点,时间最短时是左边的往左走,右边的往右走,时间最长时是左边的往右走,右边的往左走 1 #include <iostream> 2 #include<cstdio> 3 #include<algorithm> 4 #define maxn 1000000
阅读全文
posted @ 2015-10-09 20:51 cdongyang
阅读(145)
评论(0)
推荐(0)
CodeForces 567B Berland National Library hdu-5477 A Sweet Journey
摘要: 这类题一个操作增加多少,一个操作减少多少,求最少刚开始为多少,在中途不会出现负值,模拟一遍,用一个数记下最大的即可 1 #include<cstdio> 2 #include<cstring> 3 4 const int HASH=57; 5 6 int n,num[110],head[HASH],
阅读全文
posted @ 2015-10-09 16:28 cdongyang
阅读(212)
评论(0)
推荐(0)
2015年10月6日
UVA 10759 Dice Throwing
摘要: 题意为抛n个骰子凑成的点数和大于或等于x的概率,刚开始用暴力枚举,虽然AC了,但时间为2.227s,然后百度了下别人的做法,交了一遍,靠,0.000s,然后看了下思路,原来是dp,在暴力的基础上记忆化搜索,把所有可能枚举出来再累加,然后自己也打了一遍,0.000sA了,做法是开一个二维数组,第一...
阅读全文
posted @ 2015-10-06 12:14 cdongyang
阅读(283)
评论(0)
推荐(0)
2015年10月5日
UVA 11027 - Palindromic Permutation
摘要: 题目意思为解码字符串,要输出第n个回文字符串,因为对称关系,前一半确定了,后一半也就跟着确定了,所以n其实就是前一半字符串的编码,还要减去1,直接解码出来再复制给后半即可 1 #include 2 #include 3 #include 4 5 using namespace std...
阅读全文
posted @ 2015-10-05 16:55 cdongyang
阅读(179)
评论(0)
推荐(0)
UVA 10308 Roads in the North
摘要: inputu1 v1 w1u2 v2 w2...un vn wn 1 2 #include 3 #include 4 #include 5 #include 6 #define MAX 10010 7 8 using namespace std; 9 10 struct node11 {1...
阅读全文
posted @ 2015-10-05 10:20 cdongyang
阅读(236)
评论(0)
推荐(0)
2015年10月4日
UVA 571 Jugs ADD18 小白书10 数学Part1 专题
摘要: 只能往一个方向倒,如c1=3,c2=5,a b从0 0->0 5->3 2->0 2->2 0->2 5->3 4->0 4->3 1->0 1->1 5->3 3->0 3->0 0,又回到了0 0,而且倒着推回去正好是c1一直往c2倒,因为0*c2%c1->1*c2%c1->...->c1*c2...
阅读全文
posted @ 2015-10-04 11:35 cdongyang
阅读(241)
评论(0)
推荐(0)
上一页
1
···
19
20
21
22
23
24
下一页
公告