随笔分类 - ACM_线段树
摘要:http://poj.org/problem?id=3468代码:#include#include#define maxn 100010struct node{ int l,r; __int64 sum,p;}tree[maxn*4];__int64 value[maxn];void build(int l,int r,int v){ tree[v].l=l; tree[v].r=r; tree[v].p=0; if(l==r) { tree[v].sum=value[l]; return ; } int mid...
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4046非线段树的方法,纯模拟。(AC)#include #include #include using namespace std;const int maxn = 50000+5;char str[maxn];int vis[5];int dp[maxn];int main(){ int t,ncas= 1; scanf("%d",&t); while( t-- ) { printf("Case %d:\n",ncas++); int n,m; ...
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1754代码:#include#include#includeusing namespace std;#define maxn 200005int tree[4*maxn];void build(int left,int right,int root){ if(left==right) { scanf("%d",&tree[root]); } else { int mid=(left+right)/2; build(left,mid,ro...
阅读全文

浙公网安备 33010602011771号