Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- #define NMAX 22
- int n, m;
- int a[NMAX][NMAX];
- bool has(int x) {
- for (int i = 1; i <= m; i++) {
- if (a[i][n] == x) {
- return true;
- }
- }
- return false;
- }
- int main() {
- cin >> m >> n;
- for (int i = 1; i <= m; i++) {
- for (int j = 1; j <= n; j++) {
- cin >> a[i][j];
- }
- }
- for (int i = 1; i <= m; i++) {
- if (has(a[i][1])) {
- cout << a[i][1] << ' ';
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement