Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int m, n, a[21][21] = {}, vf[20] = {}, ok = 0;
- cin >> m >> n;
- for(int i = 1; i <= m; i++) { ///m linii
- for(int j = 1; j <= n; j++) { ///n coloane
- cin >> a[i][j];
- if(i == 1 && j <= n - 1) vf[a[i][j]]++; ///cresc frecv elem de pe prima linie
- if(j == n && i != 1) { ///verific ultima coloana
- vf[a[i][j]]++;
- if(vf[a[i][j]] == 2) cout << a[i][j] << ' ', ok = 1;
- }
- }
- }
- if(ok == 0) cout << "nu exista";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement