HDU 4046 Panda】的更多相关文章

HDU 4046 Panda (ACM ICPC 2011北京赛区网络赛) Panda Time Limit: 10000/4000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1816    Accepted Submission(s): 632 Problem Description When I wrote down this letter, you may have…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4046 When I wrote down this letter, you may have been on the airplane to U.S. We have known for 15 years, which has exceeded one-fifth of my whole life. I still remember the first time we went to the mov…
链接:http://acm.hdu.edu.cn/showproblem.php?pid=4046 意甲冠军:到了bw组成的长度为n的字符串(n<=50000).有m次操作(m<=10000),每次操作是询问一段范围内wbw的个数.或者改变一个字符成为w或b. 思路:建一棵线段树,每一个结点记录的是从L到R以每一个i为最左边的字母的总共的wbw的个数,单点更新的时候要更新三个点. 代码: #include <iostream> #include <cstdio> #in…
Panda Time Limit: 10000/4000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2565    Accepted Submission(s): 861 Problem Description When I wrote down this letter, you may have been on the airplane to U.S. We have kn…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=4046   题意:给出一个字符串,统计这个字符串任意区间中"wbw"出现的次数. 规定两种操作,一是查询任意区间"wbw"出现次数:二是修改某一位置的字符.   分析:比较明显的线段树,单点更新,区间查询. 线段树记录的信息是区间中出现"wbw"字符的个数,线段树的叶子节点[i,i]记录字符串str中 str[i-2][i-1][i]是否是"wb…
Panda Time Limit: 10000/4000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2838    Accepted Submission(s): 945 Problem Description When I wrote down this letter, you may have been on the airplane to U.S.  We have…
线段树单点更新,要注意两段合并多出的答案的计算即可 //============================================================================ // Name : D.cpp // Author : L_Ecry // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //==========…
还带这么做的,卧槽,15分钟就被A了的题,居然没搞出来 若某位是1,则前两个为wb,这位就是w #include<cstdio> #include<cstring> #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 using namespace std; ; ]; char str[maxn]; int num[maxn]; void pushup(int rt) { sum[rt]=sum[rt<&…
#include<stdio.h> #include<string.h> #define N  51000 char s[N]; int a[N],n; int number(int x) { return x&-x; } void creat(int x,int k) { int i; for(i=x;i<=50000;i+=number(i))    a[i]+=k; } int sum(int x) { int su=0,i; for(i=x;i>=1;i…
题意:你生活在一个魔法大陆上,你有n 魔力, 这个大陆上有m 种魔法水晶,还有n 种合成水晶的方式,每种水晶价格告诉你,并且告诉你哪些水晶你能直接造出来,哪些你必须合成才能造出来,问你n魔力最多能卖多少钱的水晶? 析:首先知道的是,如果每个所消耗的魔法水晶固定,那么这就是一个背包问题,很简单就能搞定,然而并不是,但是我们能够推出,经过一定次数的变换,这个值肯定就是固定的了而且是最小的,这个就可以用spfa进行松弛操作. 代码如下: #pragma comment(linker, "/STACK:…