当前位置:网站首页>UVA10827
UVA10827
2022-08-05 04:59:00 【小刀刺大熊】
#include <iostream>
#include <istream>
#include <sstream>
#include <vector>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <chrono>
#include <ctime>
#include <cmath>
#include <cctype>
#include <string>
#include <cstdio>
#include <iomanip>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <functional>
#include <iterator>
using namespace std;
const int maxn = 200,INF = -1e9;
int m[maxn][maxn], sum[maxn][maxn],n;
int main()
{
int t;
cin >> t;
while (t--) {
cin >> n;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
cin >> m[i][j];
m[i + n][j] = m[i][j + n] = m[i + n][j + n] = m[i][j];
}
}
int len = (n << 1) + 1,ans = INF;
for (int i = 1; i < len; i++) {
for (int j = 1; j < len; j++) {
sum[i][j] = m[i][j] + sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1];
int a = min(i, n);
int b = min(j, n);
for (int k = 0; k <= a; k++) {
for (int l = 0; l <= b; l++) {
if (!k && !l)continue;
ans = max(sum[i][j] - sum[i - k][j] - sum[i][j - l]+ sum[i - k][j - l],ans);
}
}
}
}
cout << ans << endl;
}
return 0;
}
边栏推荐
- 【转】什么是etcd
- Mysql's redo log detailed explanation
- 仪表板展示 | DataEase看中国:数据呈现中国资本市场
- [cesium] element highlighting
- Please write the SparkSQL statement
- Redis - 13、开发规范
- Visibility of multi-column attribute column elements: display, visibility, opacity, vertical alignment: vertical-align, z-index The larger it is, the more it will be displayed on the upper layer
- for..in和for..of的区别
- 小程序_动态设置tabBar主题皮肤
- C语言-大白话理解原码,反码和补码
猜你喜欢
随机推荐
Mysql的redo log详解
Mysql的undo log详解
【软考 系统架构设计师】软件架构设计③ 特定领域软件架构(DSSA)
Learning and finishing of probability theory 8: Geometric and hypergeometric distributions
C+ +核心编程
[informix] Resolving startup errors and solutions
Some conventional routines of program development (1)
Flutter learning three-Flutter basic structure and principle
Cron(Crontab)--使用/教程/实例
服务器磁盘阵列
Application status of digital twin technology in power system
Detailed explanation of Mysql's undo log
Redis哨兵模式配置文件详解
虚证、实证如何鉴别?
creo怎么测量点到面的距离
dedecms dream weaving tag tag does not support capital letters fix
[Geek Challenge 2019]FinalSQL
Shell(4) Conditional Control Statement
mutillidae download and installation
Machine Learning Overview