Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define MAX 500
- int main()
- {
- int a[MAX][MAX],n,m,niza[3], nova[MAX][MAX], k=0;
- scanf("%d%d",&n,&m);
- for (int i=0; i<n; i++){
- for(int j=0; j<m;j++)
- {
- scanf("%d",&a[i][j]);
- }
- }
- for(int i=0;i<3;i++){
- scanf("%d", &niza[i]);
- }
- for(int i=0; i<m; i++){
- int A=-1,b=-1, c=-1;
- for(int j=0; j<n; j++){
- if(a[j][i]==niza[0] )
- {
- A=1;
- }
- if(a[j][i]==niza[1])
- {
- b=1;
- }
- if(a[j][i]==niza[2])
- {
- c=1;
- }
- }
- if(A==1 && b==1 && c==1)
- continue;
- for(int j=0; j<n;j++){
- nova[j][k]=a[j][i];
- }
- k++;
- }
- printf("\n")
- ;
- for (int i=0; i<n; i++){
- for(int j=0; j<k;j++){
- printf("%d ",nova[i][j]);
- }
- printf("\n");
- }
- return 0;
- }
- /*
- 5 4
- 1 2 5 0
- 7 2 3 1
- 12 0 5 7
- 6 1 0 1
- 2 3 4 6
- 1 7 6
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement