当前位置:网站首页>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;
}
边栏推荐
猜你喜欢
The production method of the powered small sailboat is simple, the production method of the electric small sailboat
Mini Program_Dynamic setting of tabBar theme skin
Use IDEA to connect to TDengine server
Flutter学习2-dart学习
Excel Paint
Flutter学习5-集成-打包-发布
Analyses the mainstream across technology solutions
Application status of digital twin technology in power system
Machine Learning Overview
二叉树基本性质+oj题解析
随机推荐
Use IDEA to connect to TDengine server
LeetCode:1403. 非递增顺序的最小子序列【贪心】
【cesium】3D Tileset 模型加载并与模型树关联
u-boot调试定位手段
社区分享|腾讯海外游戏基于JumpServer构建游戏安全运营能力
淘宝账号如何快速提升到更高等级
Mysql的redo log详解
No regrets, the appium automation environment is perfectly built
【软考 系统架构设计师】软件架构设计③ 特定领域软件架构(DSSA)
Flutter learning three-Flutter basic structure and principle
密码学系列之:PEM和PKCS7,PKCS8,PKCS12
upload upload pictures to Tencent cloud, how to upload pictures
After controlling the export file in MySQL, it becomes \N. Is there any solution?
Understanding and use of C# on set() and get() methods
dedecms报错The each() function is deprecated
Redis - 13、开发规范
数字孪生技术在电力系统中的应用现状
How does the Flutter TapGestureRecognizer work
WPF中DataContext作用
【转】什么是etcd