1318: 数对的个数
Memory Limit:256 MB
Time Limit:1.000 S
Judge Style:Text Compare
Creator:
Submit:36
Solved:10
Description
现在给定两个长度为 $n$ 的正整数序列 $a_1,a_2,⋯,a_n$,$b_1,b_2,⋯,b_n$。
问存在多少对数对 $(i,j)$,$1≤i<j≤n$ 满足 $\frac {a_i} {a_j} = \frac {b_j} {b_i}$
问存在多少对数对 $(i,j)$,$1≤i<j≤n$ 满足 $\frac {a_i} {a_j} = \frac {b_j} {b_i}$
Input
输入第一行,一个正整数 $n$,表示序列的长度。
接下来 $n$ 行,每行两个正整数 $a_i,b_i$。
接下来 $n$ 行,每行两个正整数 $a_i,b_i$。
Output
单个整数:表示表示满足题意的数对的个数。
Sample Input Copy
3
4 5
3 8
10 2
Sample Output Copy
1
HINT
数据范围
- 对于 $50\%$ 的数据,$1≤n≤1000$
- 对于 $100\%$ 的数据,$1≤n≤1,000,000$,$1≤a_i,b_i≤1000$
- 对于 $50\%$ 的数据,$1≤n≤1000$
- 对于 $100\%$ 的数据,$1≤n≤1,000,000$,$1≤a_i,b_i≤1000$