五月天青色头像情侣网名,国产亚洲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的評論 (共 條)

分享到微博請遵守國家法律
黄龙县| 乐平市| 隆子县| 若尔盖县| 饶平县| 云梦县| 广安市| 三原县| 陇西县| 灯塔市| 定安县| 万山特区| 绵竹市| 沙坪坝区| 冷水江市| 子长县| 金堂县| 孝昌县| 郯城县| 龙海市| 凌海市| 藁城市| 攀枝花市| 兴国县| 本溪市| 东方市| 朝阳区| 思茅市| 江西省| 称多县| 嵩明县| 睢宁县| 哈巴河县| 岳阳市| 太仆寺旗| 韩城市| 化隆| 县级市| 额济纳旗| 诸暨市| 西安市|