当前位置:网站首页>UVA10827
UVA10827
2022-08-05 05:03:00 【Knife stabs the bear】
#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;
}
边栏推荐
猜你喜欢

Dephi reverse tool Dede exports function name MAP and imports it into IDA

狗仔队:表面编辑多视点图像处理

No regrets, the appium automation environment is perfectly built

ESP32 485光照度

Redis哨兵模式配置文件详解

write the story about us

Please write the SparkSQL statement

开发属于自己的node包

【cesium】3D Tileset 模型加载并与模型树关联

【学习笔记之菜Dog学C】动态内存管理之经典笔试题
随机推荐
Flutter Learning 4 - Basic UI Components
write the story about us
类的底层机制
『递归』递归概念与典型实例
The log causes these pits in the thread block, you have to guard against
[MRCTF2020] Ezpop (detailed)
Develop your own node package
重新审视分布式系统:永远不会有完美的一致性方案……
uboot开启调试打印信息
NPDP证书含金量高吗?跟PMP相比?
AUTOCAD——标注关联
密码学系列之:PEM和PKCS7,PKCS8,PKCS12
动力小帆船制作方法简单,电动小帆船制作方法
Cron(Crontab)--use/tutorial/example
狗仔队:表面编辑多视点图像处理
flex布局青蛙游戏通关攻略
span标签和p标签的区别
[Geek Challenge 2019]FinalSQL
Shell(4) Conditional Control Statement
什么是ASEMI光伏二极管,光伏二极管的作用