<浪费空间的做法,不过还是可以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 人评分
C语言训练-角谷猜想 (C++代码)(3N+1问题)浏览:1837 |
C语言程序设计教程(第三版)课后习题6.4 (C语言代码)浏览:617 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:535 |
C语言考试练习题_排列 (C语言代码)浏览:756 |
简单的a+b (C语言代码)浏览:593 |
C语言程序设计教程(第三版)课后习题1.5 (C++代码)浏览:1108 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:465 |
C语言程序设计教程(第三版)课后习题10.3 (C语言代码)浏览:560 |
Cylinder (C语言描述,蓝桥杯)浏览:1270 |
数对 (C语言代码)浏览:756 |