Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- main()
- {
- int m, n, a[100][100];
- int serija = -1, br = -1;
- int s = 1;
- int t = 1;
- cin >> m >> n;
- for (int i=0; i<m; i++)
- for (int j=0; j<n; j++)
- cin >> a[i][j];
- for (int i=0; i<m; i++)
- {
- s = 1;
- for (int j=1; j<n; j++)
- if (a[i][j] == a[i][j-1])
- s = s + 1;
- else
- if (s>t)
- {
- serija = i;
- t = s;
- s = 1;
- br = a[i][j-1];
- }
- if (s>t)
- {
- serija = i;
- t = s;
- s = 1;
- br = a[i][n-1];
- }
- }
- if (serija!=-1)
- cout << serija << " " << br << endl;
- else
- cout << "NULL" << endl;
- system ("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement