Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <ctype.h>
- #include <string.h>
- #include <math.h>
- int main() {
- int n, m;
- scanf("%d%d", &n, &m);
- int matrica[n][m];
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < m; j++) {
- scanf("%d", &matrica[i][j]);
- }
- }
- int niza[n];
- for(int i = 0; i < n; i++) {
- double suma = 0;
- for(int j = 0; j < m; j++) {
- suma += matrica[i][j];
- }
- suma /= (double) m;
- double razlika = -2000000000;
- for(int j = 0; j < m; j++) {
- if(razlika < fabs(matrica[i][j] - suma)) {
- razlika = fabs(matrica[i][j] - suma);
- niza[i] = matrica[i][j];
- }
- }
- }
- for(int i = 0; i < n; i++){
- printf("%d ", niza[i]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement