无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

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

CF:32A. Reconnaissance

2023-06-10 12:11 作者:您是打尖兒還是住店呢  | 我要投稿

According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most?d?centimeters. Captain Bob has?n?soldiers in his detachment. Their heights are?a1,?a2,?...,?an?centimeters. Some soldiers are of the same height. Bob wants to know, how many ways exist to form a reconnaissance unit of two soldiers from his detachment.

Ways?(1,?2)?and?(2,?1)?should be regarded as different.

Input

The first line contains two integers?n?and?d?(1?≤?n?≤?1000,?1?≤?d?≤?109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains?n?space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed?109.

Output

Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed?d.

相似的問題:


CF:32A. Reconnaissance的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
介休市| 巧家县| 栾城县| 儋州市| 保德县| 建水县| 涪陵区| 湖州市| 关岭| 思茅市| 南召县| 八宿县| 会宁县| 昌都县| 阳信县| 民勤县| 崇信县| 亚东县| 青龙| 内黄县| 日喀则市| 宁陕县| 昭通市| 贡觉县| 新密市| 巢湖市| 南丰县| 新建县| 阳新县| 湘潭县| 小金县| 江达县| 巴塘县| 长海县| 锦州市| 延庆县| 繁昌县| 册亨县| 新干县| 应用必备| 灯塔市|