Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f7dc06f

Browse files
Add files via upload
1 parent a17ecb1 commit f7dc06f

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /