#2635. 数对的个数
数对的个数
Description
现在给定两个长度为n的正整数序列<math xma1,a2,⋯,an,b1,b2,⋯,bn。
问存在多少对数对(i,j),1≤i<j≤n满足<math xmaj/ai=bi/bj
Input Format
输入第一行,一个正整数<math xmlns="http://www.w3.org/1998/Math/MathML">n,表示序列的长度。
接下来<math xmlns="http://www.w3.org/1998/Math/MathML">n行,每行两个正整数<math xmlns="http://www.w3.org/1998/Math/MathML">ai,bi。
Output Format
单个整数:表示表示满足题意的数对的个数。3
4 5
3 8
10 2
1
Hint
对于 <math xmlns="http://www.w3.org/1998/Math/MathML">50% 的数据,<math xmlns="http://www.w3.org/1998/Math/MathML">1≤n≤1000
对于 <math xmlns="http://www.w3.org/1998/Math/MathML">100% 的数据,<math xmlns="http://www.w3.org/1998/Math/MathML">1≤n≤1,000,000,1≤ai,bi≤1000