Qiuqiqiu |
|
||
不管道路多么崎岖坎坷,我永远不停下追逐梦想的脚步! |
2012年2月28日
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=3308View Code 1 //HDU 3308 2 #include <cstdio> 3 using namespace std; 4 const int N=100100; 5 struct segtree 6 { 7 int l,r,s,ls,rs; 8 int m() {return (l+r)/2;} 9 int len() {return r-l+1;}10 }st[N*4];11 int a[N];12 void pushup(int rt)13 {14 i... 阅读全文
摘要:
http://poj.org/problem?id=3667View Code 1 #include <cstdio> 2 using namespace std; 3 const int N=50010; 4 struct segtree 5 { 6 int l,r,s,ls,rs,c; 7 int m() {return (l+r)/2;} 8 int len() {return r-l+1;} 9 void set(int x) 10 { 11 c=x; 12 if (x==0) s=ls=rs=... 阅读全文
摘要:
http://poj.org/problem?id=3468成段增减,区间求和View Code 1 #include <cstdio> 2 using namespace std; 3 const int N=100000; 4 struct segtree 5 { 6 int l,r; 7 long long s,a; 8 int m() {return (l+r)>>1;} 9 void add(long long x) {s+=x*(r-l+1); a+=x;}10 }st[4*N];11 void pushup(int rt)12 {13 s... 阅读全文
|
Copyright © 2024 Qiuqiqiu
Powered by .NET 9.0 on Kubernetes |