ACM: 树状数组 poj 1195
来源:互联网 发布:java回退流 编辑:程序博客网 时间:2024/05/16 13:42
Description
Write a program, which receives these reports and answers queriesabout the current total number of active mobile phones in anyrectangle-shaped area.
Input
The values will always be in range, so there is no need to checkthem. In particular, if A is negative, it can be assumed that itwill not reduce the square value below zero. The indexing starts at0, e.g. for a table of size 4 * 4, we have 0 <= X<= 3 and 0 <= Y <=3.
Table size: 1 * 1 <= S * S <= 1024 *1024
Cell value V at any time: 0 <= V <=32767
Update amount: -32768 <= A <=32767
No of instructions in input: 3 <= U<= 60002
Maximum number of phones in the whole table: M= 2^30
Output
Sample Input
0 4
1 1 2 3
2 0 0 2 2
1 1 1 2
1 1 2 -1
2 1 1 2 3
3
Sample Output
3
4
题意: 在一个矩阵中, 更新矩阵的值和统计子矩阵的和.
解题思路:
C16 = A1 + A2 + A3 + A4 + A5 + A6 + A7 + A8 + A9 + A10 + A11+ A12 + A13 + A14 + A15 + A16
代码:
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
#define MAX 1050
int n;
int c[MAX][MAX];
int order;
int x1, y1, x2, y2, A;
int result;
inline int lowbit(int a)
{
}
void update(int x, int y, int val)
{
}
int getSum(int x, int y)
{
}
int main()
{
//
}
- ACM: 树状数组 poj 1195
- ACM: 树状数组 poj 2155 学习《浅…
- ACM: 树状数组 poj 3321 图论+树状…
- ACM: 树状数组 poj 2029 动态规划…
- poj 3067 Japan(树状数组)
- poj 3067 japan 树状数组
- poj 3321 Apple Tree(树状数组)
- poj 2155 Matrix (二维树状数组)
- 树状数组 poj 2352 Stars
- ACM: 树状DP 动态规划题 poj 1463 …
- ACM: 动态规划题 poj 2057 树状DP
- poj 1195 Mobile phones(二维树状…
- POj 2379 ACM Rank Table
- ACM: poj 1664
- ACM: poj 1050
- ACM: poj 1964
- ACM: poj 3141
- ACM: poj 1903
- ACM: 线段树 poj 2750 连续最大和
- ACM: 线段树 poj 3468
- ACM: 线段树 poj 3277
- ACM: 线段树 poj 2482 煽情的情书!…
- C++ 友元类
- ACM: 树状数组 poj 1195
- ACM: 树状数组 poj 2155 学习《浅…
- ACM: 树状数组 poj 3321 图论+树状…
- spring配置出错at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:244
- ACM: 线段树 poj 3264
- ACM: 线段树 poj 3368
- ACM: 并查集 poj 1703
- 凌宇的项目之旅-关于自定义锁屏
- 兴趣学习: 信息熵 ---- 《数学…