Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- int n, m;
- scanf("%d%d", &n, &m);
- int mat[n][m];
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < m; j++) {
- scanf("%d", &mat[i][j]);
- }
- }
- int a, b, c;
- scanf("%d%d%d", &a, &b, &c);
- int mat2[n][m];
- int koloni = 0;
- for(int j = 0; j < m; j++) {
- int dali_go_ima_a = -1, dali_go_ima_b = -1, dali_go_ima_c = -1;
- for(int i = 0; i < n; i++) {
- if(mat[i][j] == a) {
- dali_go_ima_a = 1;
- }
- if(mat[i][j] == b) {
- dali_go_ima_b = 1;
- }
- if(mat[i][j] == c) {
- dali_go_ima_c = 1;
- }
- }
- if(dali_go_ima_a == 1 && dali_go_ima_b == 1 && dali_go_ima_c == 1) {
- }
- else {
- for(int i = 0; i < n; i++) {
- mat2[i][koloni] = mat[i][j];
- }
- koloni++;
- }
- }
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < koloni; j++) {
- printf("%d ", mat2[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