http://acm.hdu.edu.cn/showproblem.php?pid=5265#include
#include
#include
using namespace std;
const int maxn=100000+5;
int data[maxn];
int main()
{
int m,p;
whil...
分类:
其他好文 时间:
2015-06-08 09:50:39
阅读次数:
94
题意:设有两个串A和B,现将B反转,再用插入的形式合成一个串。如:A:abc B:efg;反转B先,变gfe;作插入,agbfce。现在给出一个串,要求还原出A和B。思路:扫一遍O(n),串A在扫的时候直接输出,串2在扫的时候反向存储,再输出。 1 #include 2 #include 3 ...
分类:
其他好文 时间:
2015-06-08 01:01:34
阅读次数:
135
题意:给一个序列,找出两个数字a和b(可以相等但不可相同),要求(a+b)%p的结果最大。思路:先将所有元素模p,再排序。要找出a和b,分两种情况,a+b>p和a+b 2 #include 3 #include 4 #include 5 #include 6 #include 7 #def...
分类:
其他好文 时间:
2015-06-08 00:53:18
阅读次数:
137
//n个黑球,m个白球,第i个数为白球si = 0,为黑球si = 1;
//求这个串s中出现01的期望
//期望是可以加的
//那么对于第i个位置出现0第i+1出现1的概率为(n/(n+m))*(m/(n+m-1))
//那么期望为n*m/(n+m-1)
#include
#include
#include
using namespace std ;
int gcd(int a...
分类:
其他好文 时间:
2015-06-04 21:08:15
阅读次数:
139
1563. Bayan
Time limit: 1.0 second
Memory limit: 64 MB
As everybody knows, there are a lot of stores in skyscrapers, it's the favourite place of glamorous girls. Blonde Cindy loves only one...
分类:
其他好文 时间:
2015-06-01 13:18:28
阅读次数:
171
题目链接:CF Round #444 div1 C题目分析这道题目是要实现区间赋值的操作,同时还要根据区间中原先的值修改区间上的属性权值。如果直接使用普通的线段树区间赋值的方法,当一个节点表示的区间完全被要求修改的区间包含时,就直接打上赋值的标记然后 return 。但是这样这个节点中每个位置原先的...
分类:
其他好文 时间:
2015-05-26 20:44:45
阅读次数:
245
Problem DescriptionZCC has got N strings. He is now playing a game with Miss G.. ZCC will pick up two strings among those N strings randomly(A string ...
分类:
其他好文 时间:
2015-05-22 00:17:18
阅读次数:
169
DescriptionUser ainta loves to play with cards. He has a cards containing letter "o" and b cards containing letter "x". He arranges the cards in a row...
分类:
其他好文 时间:
2015-05-21 17:01:16
阅读次数:
133
Tales of seafaringMemory limit: 128 MBYoung Bytensson loves to hang out in the port tavern, where he often listens to the sea dogs telling their tales...
分类:
其他好文 时间:
2015-05-21 10:27:09
阅读次数:
251
题意:在前往ZJOI2015一试的路上,ZCC在同Fsygd打德州扑克时输光了所有的筹码。不过ZCC最近学会了一些黑技术。现在,他能够在游戏过程中更换任何他想要更换的牌。ZCC想要通过更换尽量少的牌得到同花顺。称五张牌构成了同花顺,当且仅当它们的数值连续,花色一致。请告诉ZCC他至少需要更换多少张牌...
分类:
其他好文 时间:
2015-05-20 13:01:58
阅读次数:
100