UDP广播协议叫吃饭


私信TA

用户名:Mustenaka

访问量:134889

签 名:

个人博客www.mustenaka.cn

等  级
排  名 12
经  验 23734
参赛次数 8
文章发表 196
年  龄 3
在职情况 学生
学  校 Sky_box
专  业 NE

  自我简介:

欢迎光临我的博客www.mustenaka.cn,Python,C#,U3D,C/C++开发合作可以找我

<浪费空间的做法,不过还是可以A的>

#include<bits/stdc++.h>
#define hh ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;	//你别管什么意思

const int maxn=105;	//相当于#define maxn 105
int n,m;	//n,m控制矩阵大小;
int arr[maxn][maxn];
int max_number,pos,sum;

int main() {
	hh;
	while(cin>>n>>m) {
		memset(arr,0,sizeof(arr));
		for(int i=0; i<n; i++) {
			max_number=INT_MIN;
			pos=0;
			sum=0;
			for(int j=0; j<m; j++) {
				cin>>arr[i][j];
				if(max_number<arr[i][j]) {
					max_number=arr[i][j];
					pos=j;
				}
				sum+=arr[i][j];
			}
			arr[i][pos]=sum;
			for(int k=0;k<m;k++){
				cout<<arr[i][k]<<' ';
			}
			cout<<endl;
		}
	}
	return 0;
}


 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区