-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcreate_matrix_mul_input.cpp
More file actions
75 lines (55 loc) · 1.02 KB
/
create_matrix_mul_input.cpp
File metadata and controls
75 lines (55 loc) · 1.02 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 <iostream>
#include <fstream>
#include <time.h>
#include <stdlib.h>
using namespace std;
enum cons {MAX_VALUE = 1000};
int a[1005][1005];
int b[1005][1005];
int main()
{
int n;
int m;
int p;
int x;
int y;
int val;
int k1;
int k2;
srand (time(NULL));
fstream f;
f.open("input.in", ios::out);
cout << "Enter N, M and P" << endl;
cin >> n;
cin >> m;
cin >> p;
f << n << " " << m << " " << p << endl;
f << endl;
k1 = (n + m) / 2;
k2 = (m + p) / 2;
f << k1 << " " << k2 << endl << endl;;
for (int i = 0; i < k1; i++) {
x = rand() % n;
y = rand() % m;
val = rand() % MAX_VALUE;
while(a[x][y]) {
x = rand() % n;
y = rand() % m;
val = rand() % MAX_VALUE;
}
f << x << " " << y << " " << val << endl;
a[x][y] = 1;
}
for (int i = 0; i < k2 ; i++) {
x = rand() % m;
y = rand() % p;
val = rand() % MAX_VALUE;
while(b[x][y]) {
x = rand() % m;
y = rand() % p;
val = rand() % MAX_VALUE;
}
b[x][y] = 1;
f << x << " " << y << " " << val << endl;
}
}