最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(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ó)家法律
无为县| 军事| 巫山县| 泰兴市| 龙海市| 百色市| 平阴县| 潢川县| 涟源市| 巩义市| 云龙县| 奇台县| 渭源县| 油尖旺区| 同心县| 通海县| 扎囊县| 岚皋县| 从江县| 广安市| 淅川县| 永州市| 滨州市| 搜索| 枣阳市| 西华县| 安新县| 北流市| 普安县| 蓝山县| 玛多县| 南昌市| 张掖市| 老河口市| 潜山县| 吴堡县| 承德县| 孟州市| 福海县| 清远市| 云林县|