Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int n,i,j,a[100][100],k,m,nr,v[100],maxi=0,c;
- cout<<"n=";cin>>n;
- cout<<"m=";cin>>m;
- for (i=0;i<n;i++)
- for (j=0;j<m;j++)
- cin>>a[i][j];
- for (i=0;i<n;i++) {
- nr=0;
- for (j=0;j<m;j++)
- if (!a[i][j])
- nr++;
- if (maxi<nr)
- {
- k=0;
- maxi=nr;
- v[k]=i;
- }
- else
- if (nr==maxi&&nr)
- {
- k++;
- v[k]=i;
- }
- }
- k++;
- for (c=0;c<k;c++)
- {
- for (i=v[c];i<n-1;i++)
- for (j=0;j<m;j++)
- a[i][j]=a[i+1][j];
- n--;
- }
- cout<<endl<<"matricea noua:"<<endl;
- for (i=0;i<n;i++) {
- for (j=0;j<m;j++)
- cout<<a[i][j]<<' ';
- cout<<endl;
- }//*/
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement