#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector> using namespace std; int main() { int n;
while (scanf("%d", &n) != EOF) { int rsum[n];
int csum[n];
int sum1 = 0;
int sum2 = 0;
memset(rsum, 0, sizeof(rsum));
memset(csum, 0, sizeof(csum)); //input
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
int temp;
scanf("%d", &temp);
if (i == j) sum1 += temp;
if (i + j == n - 1) sum2 += temp;
rsum[j] += temp;
csum[i] += temp;
}
} vector<int> ans;
ans.push_back(sum1);
ans.push_back(sum2);
for (int k = 0; k < n; ++k) {
ans.push_back(rsum[k]);
ans.push_back(csum[k]);
} sort(ans.begin(), ans.end(), [](const int &a, const int &b) {
return a - b > 0;
}); int x = ans.size();
for (int i = 0; i < x; i++) {
printf("%d", ans[i]);
if (i != x - 1) printf(" ");
}
printf("\n"); } return 0;
}

问题 E: Problem B的更多相关文章

  1. 1199 Problem B: 大小关系

    求有限集传递闭包的 Floyd Warshall 算法(矩阵实现) 其实就三重循环.zzuoj 1199 题 链接 http://acm.zzu.edu.cn:8000/problem.php?id= ...

  2. No-args constructor for class X does not exist. Register an InstanceCreator with Gson for this type to fix this problem.

    Gson解析JSON字符串时出现了下面的错误: No-args constructor for class X does not exist. Register an InstanceCreator ...

  3. C - NP-Hard Problem(二分图判定-染色法)

    C - NP-Hard Problem Crawling in process... Crawling failed Time Limit:2000MS     Memory Limit:262144 ...

  4. Time Consume Problem

    I joined the NodeJS online Course three weeks ago, but now I'm late about 2 weeks. I pay the codesch ...

  5. Programming Contest Problem Types

        Programming Contest Problem Types Hal Burch conducted an analysis over spring break of 1999 and ...

  6. hdu1032 Train Problem II (卡特兰数)

    题意: 给你一个数n,表示有n辆火车,编号从1到n,入站,问你有多少种出站的可能.    (题于文末) 知识点: ps:百度百科的卡特兰数讲的不错,注意看其参考的博客. 卡特兰数(Catalan):前 ...

  7. BZOJ2301: [HAOI2011]Problem b[莫比乌斯反演 容斥原理]【学习笔记】

    2301: [HAOI2011]Problem b Time Limit: 50 Sec  Memory Limit: 256 MBSubmit: 4032  Solved: 1817[Submit] ...

  8. [LeetCode] Water and Jug Problem 水罐问题

    You are given two jugs with capacities x and y litres. There is an infinite amount of water supply a ...

  9. [LeetCode] The Skyline Problem 天际线问题

    A city's skyline is the outer contour of the silhouette formed by all the buildings in that city whe ...

  10. PHP curl报错“Problem (2) in the Chunked-Encoded data”解决方案

    $s = curl_init(); curl_setopt($s, CURLOPT_POST, true); curl_setopt($s, CURLOPT_POSTFIELDS, $queryStr ...

随机推荐

  1. Linux tcpdump 命令详解与示例

    命令概要 Linux作为网络服务器,特别是作为路由器和网关时,数据的采集和分析是不可少的.TcpDump 是 Linux 中强大的网络数据采集分析工具之一. 用简单的话来定义tcpdump,就是:du ...

  2. filebeat+kafka

    kafka出现接收不到filebeat数据,最后发现版本兼容问题 filebeat换成  filebeat-7.4.2-linux-x86_64 kafka是docker-compose启动的,版本是 ...

  3. k8s系列---stateful(有状态应用副本集)控制器

    http://blog.itpub.net/28916011/viewspace-2215046/ 在应用程序中,可以分为有状态应用和无状态应用. 无状态的应用更关注于群体,任何一个成员都可以被取代. ...

  4. 高可用web架构: LVS+keepalived+nginx+apache+php+eaccelerator(+nfs可选 可不选)

            LVS(负载均衡器).Heartbeat.Corosync.Pacemaker.Web高可用集群.MySQL高可用集群.DRDB.iscsi.gfs2.cLVM等,唯一没有讲解的就是L ...

  5. StarUML之四、StarUML的Diagrams(图)与Elements(元素)及相关属性

    Diagrams(图)可以理解为画布  1:创建图 在右侧的Model Explorer管理界面的第一个节点右键,或者选择菜单中Model | Add Diagram | [DiagramType]都 ...

  6. 盒模型大小取决于它的padding,margin,border数值

    盒模型规定了元素框处理元素内容width与height值.内边距padding.边框border 和 外边距margin 的数值大小.边框内的空白是内边距padding,边框外的空白是外边距margi ...

  7. ViewPager调用notifyDataSetChanged() 刷新问题解决方案

    一.问题来由 ViewPager控件很大程度上满足了开发者开发页面左右移动切换的功能,使用非常方便.但是使用中发现,在删除或者修改数据的时候,PagerAdapter无法像BaseAdapter那样仅 ...

  8. CentOS6 用yum安装mysql详解,简单实用

    一.查看CentOS下是否已安装mysql 输入命令 :yum list installed | grep mysql 二.删除已安装mysql 输入命令: yum -y remove mysql 如 ...

  9. 【redis】pipeline - 管道模型

    redis-pipeline 2020-02-10: 因为我把github相关的wiki删了,所以导致破图...待解决.(讲真github-wiki跟project是2个url,真的不好用) 因为用的 ...

  10. centos7添加网卡

    centos7添加桥接网卡 1.使用ip a 命令查看是否有新加的网卡 如上图新网卡为ens36,默认分配ip为192.168.3.14 2. 使用nmcli conn 命令查看新网卡的uuid 3. ...