题目大意:
给出一个由0,1构成的矩阵,询问(a,b)到(c,d)两个点之间的只含有0的矩形有多少个。
方法:
由于矩阵不大,最多40*40,而且询问量很大(10^5)由此我们考虑o(1)输出答案,首先用一个四维数组预处理出答案,最后直接输出即可。
令dp[a][b][c][d]为(a,b)到(c,d)两个点之间的只含有0的矩形的数量,
则递推的公式:
dp[a][b...
分类:
其他好文 时间:
2014-08-24 16:47:42
阅读次数:
277
题意,给出一个n行m列的矩阵
里面元素是0或者1
给出q个询问
a,b,c,d
求(a,b)到(c,d)有多少个由0组成的矩形
我们定义
即为求(a,b)到(c,d)有多少个由0组成的矩形
对一个矩形来说
dp[a][b][c][d]=dp[a][b][c][d-1]+dp[a][b][c-1][d]-dp[a][b][c-1][d-1]+包含右下角(当前点)的矩形;
重...
分类:
其他好文 时间:
2014-08-24 15:29:52
阅读次数:
203
Description
Combinatorics is a branch of mathematics chiefly concerned with counting discrete objects. For instance, how many ways can you pick two people out of a crowd of
n people? Into how many...
分类:
其他好文 时间:
2014-08-23 20:24:01
阅读次数:
317
Description
We are given a rooted tree of n vertices. The vertices are to be labeled with numbers
1, 2,..., n so that each label is unique and the heap condition holds, i.e. the label of any verte...
分类:
其他好文 时间:
2014-08-22 17:53:39
阅读次数:
264
Description
Triangles are polygons with three sides and strictly positive area. Lattice triangles are the triangles all whose vertexes have integer coordinates. In this problem you have to find the...
分类:
其他好文 时间:
2014-08-21 22:56:15
阅读次数:
443
/*Prime Cuts
Description
A prime number is a counting number (1, 2, 3, ...) that is evenly divisible only by 1 and itself. In this problem you are to write a program that will cut some number of pri...
分类:
其他好文 时间:
2014-08-21 17:14:24
阅读次数:
283
1148 - Mad Counting
PDF (English) Statistics Forum
Time Limit: 0.5 second(s) Memory Limit: 32 MB
Mob was hijacked by the mayor of the Town "TruthTown". Mayor wants Mob to count the total population...
分类:
其他好文 时间:
2014-08-21 11:34:55
阅读次数:
261
Kindergarten Counting Game
Everybody sit down in a circle. Ok. Listen to me carefully.
``Woooooo, you scwewy wabbit!''
Now, could someone tell me how many words I just said?
Input and...
分类:
其他好文 时间:
2014-08-20 18:04:02
阅读次数:
205
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4613
数学统计...
分类:
其他好文 时间:
2014-08-20 12:35:02
阅读次数:
155
Boring counting
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768
K (Java/Others)
Problem Description
...
分类:
其他好文 时间:
2014-08-19 10:55:54
阅读次数:
220