mitkonikov

Skalaren Proizvod

Nov 4th, 2019
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main()
  7. {
  8. int n;
  9. cin >> n;
  10.  
  11. int a[n][n];
  12.  
  13. for (int i = 0; i < n; i++) {
  14. for (int j = 0; j < n; j++) {
  15. cin >> a[i][j];
  16. }
  17. }
  18.  
  19. int p, q;
  20. cin >> p >> q;
  21.  
  22. int zbir = 0;
  23.  
  24. for (int i = 0; i < n; i++) {
  25. zbir += (a[p][i] * a[i][q]);
  26. }
  27.  
  28. cout << zbir << endl;
  29.  
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment