TopCoder

User's AC Ratio

100.0% (2/2)

Submission's AC Ratio

100.0% (2/2)

Tags

Description

給你兩個長度為 $N$ 的數列 $A_1, A_2, \dots, A_N$ 和 $B_1, B_2, \dots, B_N$,請計算他們的內積。兩個數列的內積定義為 $A_1\cdot B_1 + A_2\cdot B_2 + \dots + A_N\cdot B_N$,也就是兩兩相乘之和。

Input Format

輸入一共三行。第一行有一個數字 $N$,代表數列 $A$ 和數列 $B$ 的長度。第二行有 $N$ 個用空白分隔的數字,代表 $A_1\space A_2\dots\space A_N$。第三行有 $N$ 個用空白分隔的數字,代表 $B_1\space B_2\dots\space B_N$。

  • $-1000\le A_i \le 1000$
  • $1 \le N\le 1000$

Output Format

請輸出一個數字,代表內積的結果。

Sample Input 1

3
1 2 3
3 2 1

Sample Output 1

10

Sample Input 2

10
976 575 -855 691 222 839 -66 845 -471 707
296 879 113 -444 -623 555 -68 112 -87 820

Sample Output 2

1438086

Hints

Problem Source

Subtasks

No. Testdata Range Constraints Score
1 0~1 範例測資 0
2 0~10 無額外限制 100

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 524288 65536 1 2
1 1000 524288 65536 1 2
2 1000 524288 65536 2
3 1000 524288 65536 2
4 1000 524288 65536 2
5 1000 524288 65536 2
6 1000 524288 65536 2
7 1000 524288 65536 2
8 1000 524288 65536 2
9 1000 524288 65536 2
10 1000 524288 65536 2