当前位置:网站首页>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;
}
边栏推荐
- [MRCTF2020] Ezpop (detailed)
- Talk about 20 common problems in data governance
- AUTOCAD - dimension association
- Day019 Method overriding and introduction of related classes
- How to deal with DNS hijacking?
- dedecms error The each() function is deprecated
- MySQL Foundation (1) - Basic Cognition and Operation
- [Nine Lectures on Backpacks - 01 Backpack Problems]
- 算法---一和零(Kotlin)
- 仪表板展示 | DataEase看中国:数据呈现中国资本市场
猜你喜欢

Error creating bean with name ‘configDataContextRefresher‘ defined in class path resource

The solution to the failure to read channel information when dedecms generates a message in the background

基于Web的商城后台管理系统的设计与实现

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

机器学习概述

u-boot调试定位手段

Dephi逆向工具Dede导出函数名MAP导入到IDA中

for..in和for..of的区别

flink reads mongodb data source

大学物理---质点运动学
随机推荐
bytebuffer use demo
Homework 8.4 Interprocess Communication Pipes and Signals
MySQL中控制导出文件后变为了\N有什么解决方案吗?
使用IDEA连接TDengine服务器
淘宝账号如何快速提升到更高等级
overloaded operator
数字_获取指定位数的小数
开发属于自己的node包
七夕节赚徽章拉
uboot enable debug printing information
Detailed explanation of Mysql's undo log
[8.3] Code Source - [meow ~ meow ~ meow~] [tree] [and]
【cesium】Load and locate 3D Tileset
Excel Paint
Mvi架构浅析
In the WebView page of the UI automation test App, the processing method when the search bar has no search button
C language - vernacular to understand the original code, inverse code and complement code
大学物理---质点运动学
[Nine Lectures on Backpacks - 01 Backpack Problems]
Is the NPDP certificate high in gold content?Compared to PMP?