Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define MAX 500
- int main()
- {
- int a[MAX][MAX];
- int n,m,j,i;
- // printf("Vnesi dimenzii na matricata:\n");
- scanf("%d%d",&n,&m);
- for(i=0; i<n; i++){
- for(j=0; j<m; j++){
- // printf("a[%d][%d]=",i,j);
- scanf("%d",&a[i][j]);
- }
- }
- int k, b[MAX][MAX], s=2;
- // printf("Matricata e:\n");
- for(i=0; i<n; i++){
- for(j=0; j<m; j++){
- // printf("%d ",a[i][j]);
- b[i][j] = a[i][j];
- }
- // printf("\n");
- }
- // printf("Vnesi indeks: ");
- scanf("%d", &k);
- // printf("Vnesi parovi\n");
- int zbir = 0;
- int broj_na_parovi = 0;
- //scanf("%d %d",&s );
- for(i = 0; i < k; i++) {
- int pi, pj;
- scanf("%d%d", &pi, &pj);
- if(pi >= 0 && pi < n && pj >= 0 && pj < m) {
- zbir += a[pi][pj];
- broj_na_parovi++;
- b[pi][pj] = -1;
- }
- }
- int prosek = zbir / broj_na_parovi;
- for( i =0 ; i < n; i++) {
- for( j = 0; j < m; j++) {
- if(b[i][j] == -1) {
- printf("(%d) ", a[i][j]);
- }
- else {
- printf("%d ", a[i][j]);
- }
- }
- printf("\n");
- }
- return 0;
- }
- /*
- 5 4
- 1 2 5 0
- 7 2 3 1
- 12 0 5 4
- 6 1 0 1
- 2 3 4 5
- 4
- 1 2
- 0 4
- 5 1
- 2 2
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement