题目1191:矩阵最大值
来源:互联网 发布:结对编程 恶搞 编辑:程序博客网 时间:2024/06/08 07:42
#include <iostream>#include <algorithm>#include <queue>#include <vector>#include <cstring>#include <stack>#include <string>#include <string.h>#include <stdio.h>#include <cmath>#include <map>#include <functional>#include <set>#include <limits.h>#include <math.h>#include <ctype.h>using namespace std;//1191 int m,n;int mtr[101][101];int main(){ //freopen("input.txt","r",stdin); while(cin>>m>>n) { memset(mtr,0,sizeof(mtr)); for(int i=1;i<=m;i++) for(int j=1;j<=n;j++) cin>>mtr[i][j]; for(int i=1;i<=m;i++) { int mx=-1,sum=0; int j,idx=0; for(j=1;j<=n;j++) { sum+=mtr[i][j]; if(mtr[i][j]>mx) mx=mtr[i][j],idx=j; } mtr[i][idx]=sum; } for(int i=1;i<=m;i++) { bool flag=true; for(int j=1;j<=n;j++) { if(flag) cout<<mtr[i][j]; else cout<<" "<<mtr[i][j]; flag=false; } cout<<endl; } } return 0;}/************************************************************** Problem: 1191 User: cust123 Language: C++ Result: Accepted Time:110 ms Memory:1560 kb****************************************************************/
0 0
- 题目1191:矩阵最大值
- 题目1191:矩阵最大值
- 题目1191:矩阵最大值
- 题目1191:矩阵最大值
- 题目1191:矩阵最大值
- 题目1191:矩阵最大值
- 九度OJ 题目1191:矩阵最大值
- 九度OJ 题目1191:矩阵最大值
- 【九度OJ】题目1191:矩阵最大值 解题报告
- 1191 矩阵最大值
- 矩阵最大值
- 矩阵最大值
- 九度oj-1191-矩阵最大值
- 【九度OJ】1191:矩阵最大值
- 九度OJ 1191:矩阵最大值 (矩阵计算)
- 题目85:求最大值
- 题目1046:求最大值
- 题目1046:求最大值
- Centos7 配置阿里云yum源
- Linux安装redis
- Some interesting facts about static member functions in C++
- 程序员搞笑故事:给女儿织的辫子 ,你知道是什么算法吗?
- unity脚本执行顺序详解
- 题目1191:矩阵最大值
- 调用系统软键盘
- 从菜鸟到架构师(十五)
- thinkphp 同时上传多张图片文件名重复问题
- (笔记)理解和学习分布式一致性协议:raft
- 交换机堆叠和集群配置与管理——1
- 题目1192:回文字符串
- Java 获取键盘输入
- linux exercise 9