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