五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

CF 215A - Bicycle Chain

2023-08-22 09:05 作者:您是打尖兒還是住店呢  | 我要投稿

Vasya's bicycle chain drive consists of two parts: n stars are attached to the pedal axle, m stars are attached to the rear wheel axle. The chain helps to rotate the rear wheel by transmitting the pedal rotation.


We know that the i-th star on the pedal axle has ai (0?<?a1?<?a2?<?...?<?an) teeth, and the j-th star on the rear wheel axle has bj (0?<?b1?<?b2?<?...?<?bm) teeth. Any pair (i,?j) (1?≤?i?≤?n; 1?≤?j?≤?m) is called a gear and sets the indexes of stars to which the chain is currently attached. Gear (i,?j) has a gear ratio, equal to the value .


Since Vasya likes integers, he wants to find such gears (i,?j), that their ratios are integers. On the other hand, Vasya likes fast driving, so among all "integer" gears (i,?j) he wants to choose a gear with the maximum ratio. Help him to find the number of such gears.


In the problem, fraction? denotes division in real numbers, that is, no rounding is performed.


Input

The first input line contains integer n (1?≤?n?≤?50) — the number of stars on the bicycle's pedal axle. The second line contains n integers a1,?a2,?...,?an (1?≤?ai?≤?104) in the order of strict increasing.


The third input line contains integer m (1?≤?m?≤?50) — the number of stars on the rear wheel axle. The fourth line contains m integers b1,?b2,?...,?bm (1?≤?bi?≤?104) in the order of strict increasing.


It is guaranteed that there exists at least one gear (i,?j), that its gear ratio is an integer. The numbers on the lines are separated by spaces.


Output

Print the number of "integer" gears with the maximum ratio among all "integer" gears.

-------------------------------

Vasya 的自行車鏈條傳動由兩部分組成:n 顆星附著在踏板軸上,m 顆星附著在后輪軸上。 鏈條通過傳遞踏板旋轉(zhuǎn)來幫助后輪旋轉(zhuǎn)。


我們知道踏板軸上的第i顆星有ai(0?<?a1?<?a2?<?...?<?an)齒,后輪軸上的第j顆星有bj(0?<?b1?<?b2?<?。 ...?<?bm) 牙齒。 任何對 (i,?j) (1?≤?i?≤?n; 1?≤?j?≤?m) 稱為齒輪,并設(shè)置鏈當(dāng)前所連接的恒星的索引。 Gear (i,?j) 的齒輪比等于值 。


由于 Vasya 喜歡整數(shù),他想找到這樣的齒輪 (i,?j),其比率為整數(shù)。 另一方面,Vasya 喜歡快速駕駛,因此在所有“整數(shù)”檔位 (i,?j) 中,他想選擇速比最大的檔位。 幫助他找到這樣的齒輪的數(shù)量。


問題中,分?jǐn)?shù)表示實數(shù)除法,即不進(jìn)行舍入。


輸入

第一個輸入行包含整數(shù) n (1?≤?n?≤?50) — 自行車踏板軸上的星星數(shù)量。 第二行包含n個整數(shù)a1,?a2,?...,?an (1?≤?ai?≤?104),按照嚴(yán)格遞增的順序。


第三輸入行包含整數(shù) m (1?≤?m?≤?50)——后輪軸上的星星數(shù)量。 第四行包含 m 個整數(shù) b1,?b2,?...,?bm (1?≤?bi?≤?104),按嚴(yán)格遞增的順序排列。


保證至少存在一個檔位(i,?j),且其傳動比為整數(shù)。 行上的數(shù)字由空格分隔。


輸出

打印所有“整數(shù)”齒輪中傳動比最大的“整數(shù)”齒輪的數(shù)量。

------------------------

一個是用來保存最大值的,一個是用來存儲每個值存在的次數(shù)的,最后返回最大值的次數(shù)即可;

下面是代碼:


CF 215A - Bicycle Chain的評論 (共 條)

分享到微博請遵守國家法律
鄂州市| 平武县| 密云县| 长乐市| 武鸣县| 铜梁县| 建宁县| 攀枝花市| 桐梓县| 临朐县| 鄱阳县| 昔阳县| 拉萨市| 光山县| 四川省| 固安县| 东宁县| 同德县| 项城市| 大田县| 宜黄县| 建水县| 桐柏县| 宿迁市| 新宾| 女性| 商河县| 七台河市| 平山县| 闽侯县| 蓬安县| 宁波市| 榆林市| 淅川县| 平安县| 宜章县| 漯河市| 万载县| 册亨县| 乐陵市| 庆城县|