Created
December 15, 2017 05:20
-
-
Save oskimura/3392ec2fc56cc356834afa0d56417719 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cmath> | |
#include <sstream> | |
#include <string> | |
#include <vector> | |
#include <algorithm> | |
#include <functional> | |
#include <numeric> | |
int main() | |
{ | |
int n,m; | |
std::cin >> n >> m; | |
int **matrix = new int*[n]; | |
for (int i=0;i<n;i++) { | |
matrix[i] = new int[m]; | |
} | |
for (int i=0; i<n; i++) { | |
for (int j=0; j<m; j++) { | |
int num; | |
std::cin >> num; | |
matrix[i][j] = num; | |
} | |
} | |
int *vec = new int[m]; | |
for (int i=0;i<m;i++) { | |
std::cin >> vec[i]; | |
} | |
int *result = new int[n]; | |
for (int i=0;i<n;i++) { | |
int c = 0; | |
for (int j=0;j<m;j++) { | |
c = c + vec[j] * matrix[i][j]; | |
} | |
result[i] = c; | |
} | |
for (int i=0; i<n;i++) { | |
std::cout << result[i] << std::endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment