当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

4189:Cybercrime Donut Investigation

题目描述
Year 2042. The Internet has evolved to a virtual reality dataspace where crimes are committed every day. The 2041 SWERC winner developed an agent that drops a donut every time a crime is committed in the Cyberspace. Each of the donuts has its own signature. The Madrid Police have a huge database with crimes and their donut signatures.
Today is your day. Your task is to implement a new agent that looks for the records in the database that bear a strong resemblance to the given signature of a dropped donut found at a new crime scene.

Figure 2: The major piece of evidence for today's unsolved crime streak

Experts in virtual criminology have obtained the best similarity measure between donuts: compute the diff erence in radius of the internal part of the toroids (holes), compute the di fference in radius of the external part of the toroids (tubes), and then add up those di fferences.
输入解释
The fi rst line of each test case contains n (1<=n<=100,000), the number of donuts in the database. The ith of the following n lines contains the radius of the hole and radius of the tube of the ith donut in the database, described by two integers l and w (1<=l,w<=109). After that there is a line containing q
(1<=q<=50,000), the number of donuts that you are looking for in the database. Then q lines follow, the ith of them describing the dimensions of the newly found ith donut in the same way.
Diff erent test cases are separated by a blank line. A line containing -1 marks the end of the input.
输出解释
The output of your program on each test case should have q lines, each of them containing an integer. The ith of these lines should contain the similarity between the newly found ith donut and the donut in the
database that most closely resembles it. Outputs for di fferent test cases should be separated by a blank line.
输入样例
2
2 3
3 4
2
1 1
3 4

2
1 1
9 9
4
4 5
6 5
2 5
3 4

-1
输出样例
3
0

7
7
5
5
来自杭电HDUOJ的附加信息
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

题目来源 SWERC 2011

源链接: HDU-4189

最后修改于 2020-10-25T23:11:06+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
30000/15000MS(Java/Others) 65536/32768K(Java/Others)