Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- //#include <fstream>
- using namespace std;
- //ifstream fin("matrice7.in");
- //ofstream fout("matrice7.out");
- int main()
- {
- int n,m,a[101][101],s[101]={0};
- cin>>n>>m;
- for(int i=1;i<=n;i++)
- for(int j=1;j<=m;j++)
- {
- cin>>a[i][j];
- s[i]+=a[i][j];
- }
- for(int i=1;i<n;i++)
- for(int j=i+1;j<=n;j++)
- {
- if(s[i]>s[j])
- {
- swap(s[i],s[j]);
- for(int k=1;k<=m;k++)
- swap(a[i][k],a[j][k]);
- }
- }
- for(int i=1;i<=n;i++)
- {
- for(int j=1;j<=m;j++)
- cout<<a[i][j]<<" ";
- cout<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement