-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic.cpp
More file actions
72 lines (68 loc) · 1.39 KB
/
basic.cpp
File metadata and controls
72 lines (68 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <complex>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
#ifdef FIL
#include <fstream>
std::ifstream cin("inputMatrix2.txt");
std::ofstream cout("output.txt");
#else
#include <iostream>
using std::cin;
using std::cout;
#endif
long long int mult(long long int* a,long long int *b,int n){
long long int sum = 0;
for (int i = 0; i < n; ++i)
{
sum+=a[i]*b[i];
}
return sum;
}
int main(int argc, char* argv[])
{
long long int n;
cin >> n;
long long int* a[n];
long long int* b[n];
long long int* c[n];
printf("%lld\n",n);
for(int i = 0; i < n; i++){
a[i] = new long long int[n];
b[i] = new long long int[n];
for(int j = 0; j < n; j++){
cin >> a[i][j];
}
}
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
cin >> b[j][i];
}
}
for(int i = 0; i < n; i++){
c[i] = new long long int[n];
for (int j = 0; j < n; j++)
{
cout << mult(a[i],b[j],n) << " ";
}
cout << "\n";
}
return 0;
}