Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //10.3//
- //main.cpp
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int n, m, p;
- int **v, **w, *x, *y={}, *s={};
- scanf("%d", &m);
- scanf("%d", &n);
- scanf("%d", &p);
- v=(int**)malloc(m*sizeof(int*));
- for(int i=0; i<m; i++)
- v[i]=(int*)malloc(n*sizeof(int));
- w=(int**)malloc(n*sizeof(int*));
- for(int i=0; i<n; i++)
- w[i]=(int*)malloc(p*sizeof(int));
- for(int i=0; i<m; i++)
- for(int j=0; j<n; j++)
- scanf("%d", &v[i][j]);
- for(int i=0; i<n; i++)
- for(int j=0; j<p; j++)
- scanf("%d", &w[i][j]);
- x=(int*)malloc(m*sizeof(int));
- s=(int*)malloc(n*sizeof(int));
- y=(int*)malloc(p*sizeof(int));
- for(int i=0; i<m; i++)
- scanf("%d", &x[i]);
- for(int j=0; j<n; j++)
- for(int i=0; i<m; i++)
- s[j]+=(x[i]*v[i][j]);
- for(int k=0; k<p; k++)
- for(int j=0; j<n; j++)
- y[k]+=(s[j]*w[j][k]);
- int poz=0;
- for(int i=1; i<p; i++)
- if(y[i]>y[poz])
- poz=i;
- printf("%d", poz+1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement