摘要: 原题链接:http://acm.uestc.edu.cn/problem.php?pid=1730分析:线段树单点更新,区间求和。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define maxn 500005 7 #define mod 1000007 8 using namespace std; 9 int sum[maxn>1;19 build(l,m,rt>1;30 if(ii>1;38 int res=0;39 if(L=m+1)res^=get_sum(L,R,m+1,r,rt... 阅读全文
posted @ 2013-08-31 15:52 EtheGreat 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 原题链接:http://acm.uestc.edu.cn/problem.php?pid=1727分析:用 l[i] 记录第 i 层楼有多少物品需要往上继续搬运,如果某层楼没有物品,但是更上面还有,则仍需要往上走,所以需要+1. 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define maxn 111 7 #define mod 1000007 8 using namespace std; 9 int l[maxn];10 int main()11 {12 int n,cas=1,s,t,rig;13 w... 阅读全文
posted @ 2013-08-31 15:13 EtheGreat 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 原题链接:http://acm.uestc.edu.cn/problem.php?pid=1732分析:dp,n个相同物品放入m个相同的盒子(允许为空)的个数为dp[n][m]=dp[n][m-1]+dp[n-m][m];dp[n][m-1]表示有空盒的情况,dp[n-m][m]表示没有空盒的情况。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define maxn 101 7 #define mod 1000007 8 using namespace std; 9 int dp[maxn][maxn];10 void s 阅读全文
posted @ 2013-08-31 13:52 EtheGreat 阅读(125) 评论(0) 推荐(0) 编辑