File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed
Contests/AtCoder Beginner Contest 121/Programs Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < iostream>
2
+ #include < vector>
3
+ #include < algorithm>
4
+
5
+ using namespace std ;
6
+
7
+ int dot_product (vector <int > &A, vector <int > &B)
8
+ {
9
+ int answer = 0 ;
10
+ for (int i = 1 ; i < A.size (); i++)
11
+ {
12
+ answer += A[i]*B[i];
13
+ }
14
+ return answer;
15
+ }
16
+
17
+ int main ()
18
+ {
19
+ int no_of_rows, no_of_columns, C;
20
+ cin >> no_of_rows >> no_of_columns >> C;
21
+
22
+ vector <int > B (no_of_columns + 1 );
23
+ for (int i = 1 ; i <= no_of_columns; i++)
24
+ {
25
+ cin >> B[i];
26
+ }
27
+
28
+ vector <vector <int > > A (no_of_rows + 1 , vector <int > (no_of_columns + 1 ));
29
+ for (int i = 1 ; i <= no_of_rows; i++)
30
+ {
31
+ for (int j = 1 ; j <= no_of_columns; j++)
32
+ {
33
+ cin >> A[i][j];
34
+ }
35
+ }
36
+
37
+ int good_rows = 0 ;
38
+ for (int i = 1 ; i <= no_of_rows; i++)
39
+ {
40
+ good_rows += (dot_product (A[i], B) + C > 0 );
41
+ }
42
+
43
+ cout << good_rows << " \n " ;
44
+
45
+ return 0 ;
46
+ }
47
+
48
+
You can’t perform that action at this time.
0 commit comments