-->
当前位置:首页 > 题库

PROGRAMMING:King of Karaoke Again

Luz5年前 (2021-05-10)题库451
It's Karaoke time! Little Gyro is performing the song Powder Snow in the game King of Karaoke. The song performed by Little Gyro can be considered as an integer sequence $$D_ 1,D_ 2,...,D_ n$$, and the standard version of the song can be considered as another integer sequence $$S_ 1,S_ 2,...,S_ n$$. The score is the number of integers  $$ i$$   satisfying $$1≤i≤n$$ and $$K*D_ i+S_ i=0$$.
As a good tuner, Little Gyro can choose an integer  $$ K$$  ( can be positive, 0, or negative) as his tune and multiple $$K$$ to every element   in $$D$$ satisfying $$K*D_ i+S_ i=0$$. Can you help him maximize his score by choosing a proper tune?
### Input Specification:
There are multiple test cases. The first line of the input contains an integer $$T$$ (about 100), indicating the number of test cases. For each test case:
The first line contains one integer $$n$$ (1≤$$n$$≤$$10^5$$), indicating the length of the sequences $$D$$ and $$S$$.
The second line contains $$n$$ integers $$D_ 1,D_ 2,...,D_ n$$ ($$-10^9$$≤$$D_ i$$≤$$10^9$$), indicating the song performed by Little Gyro.
The third line contains $$n$$ integers $$S_ 1,S_ 2,...,S_ n$$ ($$-10^9$$≤$$S_ i$$≤$$10^9$$), indicating the standard version of the song.
It's guaranteed that at most 5 test cases have $$n$$>100.
### Output Specification:
For each test case output one line containing one integer, indicating the maximum possible score.
### Sample Input:
```in
four
five
1 2 3 4 5
2 4 7 11 3
three
13 37 39
1 2 3
four
0 0 0 0
1 2 3 4
three
1 2 -1
-6 -12 6
```
### Sample Output:
```out
two
two
0
three
```
### Hint:
In the first example, Little Gyro may choose $$K$$=−2.
In the second example, Little Gyro may choose $$K$$=−1/13.
In the third example, Little Gyro cannot obtain any zero in each elements, no matter which $$K$$ Little Gyro chooses.
In the fourth example, Little Gyro may choose $$K$$=6.
**Adapted from The 15th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple**






answer:If there is no answer, please comment