题目描述
blablabla
样例
blablabla
算法1
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
blablabla
算法2
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
int n, m, k;
int q[1010][1010];
int s[1010][1010];
int main()
{
cin >> n >> m >> k;
cout << n << " " << m << " " << k << endl;
for (int i = 1; i <= n; i++)
for (int j = 1; i <= m; j++)
scanf("%d", &q[i][j]);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= m; j++)
s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1] + q[i][j];
while (k--)
{
int x1, y1, x2, y2;
cout << s[x2][y2] - s[x1][y2] - s[x2][y1] + s[x1][y1] << endl;
}
system("pause");
}