Problem Description In a galaxy far, far away, there are two integer sequence a and b of length n.b is a static permutation of 1 to n. Initially a is filled with zeroes.There are two kind of operations:1. add l r: add one for al,al+1...ar 2. query l
http://uoj.ac/problem/17 dp,注意细节. #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int in() { int k = 0, fh = 1; char c = getchar(); for(; c < '0' || c > '9'; c = getchar()) if (c == '-') fh = -1; for(; c
http://codeforces.com/problemset/problem/121/E 题意: Petya 喜欢幸运数,幸运数只包含 4 和 7 这两个数字.例如 47,744,4 都是幸运数字,但 5,16,467 不是. Petya 有一个 N 个数的数组,他想给这个数组执行 M 个操作,可以分为两种操作: add l r d 把第 l 到 第 r 个数都加上 d: count l r 统计第 l 到第 r 个数有多少个幸运数字. 喜闻乐见的数据结构题. 更加喜闻乐见的是这题能用树状数