湖大训练赛8 Bad Signal
来源:互联网 发布:大数据的定义及特点 编辑:程序博客网 时间:2024/05/01 20:00
There is an important UN meeting in town. Any self-respecting espionage agency will try to eavesdrop on the delegations to gain some advantage in the negotiations. They do this by planting hidden microphones in and around the meeting places. Those microphones continuously capture sound waves and transmit them via radio.
In fact, fierce competition between espionage agencies has left the whole city scattered with hidden microphones, so much so that the radio waves interfere with each other and it is often not even possible to make out any signal in the mess of radio waves ? depending on your position and proximity to the different transmitters obviously. Specifically, it is possible to make out a signal i if and only if:
Input
On the first line one positive number: the number of test cases, at most 100. After that per test case:
one line with an integer n (0 n 100 000): the number of planted microphones.
one line with the integer B (0 B 1 000 000): the level of background noise.
one line with two space-separated integers x and y: the x and y coordinates of the location Plisten where you receive the signals. n lines with three space-separated integers xi, yi and si (0 < si 1 000 000): the x and y coordinates of the location Pi of microphone i and its signal strength, respectively.
All coordinates are in the range [0; 10 000]. The locations Pi all differ from Plisten. The test data is constructed so that small floating point rounding errors will not influence the outcome of any solution.
Output
Per test case:
one line with an integer: the (one-based) index of a microphone, the signal of which can be made out, or the string “NOISE” if there is no such microphone.
Sample Input
3410100 10090 90 20000110 90 5090 110 1000110 110 504100100 10090 90 20000110 90 5090 110 1000110 110 50200 100 0 10000 8 1Sample Output
1NOISE1
很久没做HNU的训练赛了,太懒了吧,时间太蛋疼了,中午想午休的好么。但是看到水题能够得到Aceept还是很亢奋的。就不会想睡觉了。总觉得就是题目比较蛋疼难懂。
题意:有一个圆桌会议(好吧,圆桌我自己编的)开在坐标为xx,yy的地方,有个强度为B的值,知道就好,然后有N个麦克风,应该算窃听器吧。每个麦克风坐标是xi,yi,有一个si的值,这个知道就好了。问存不存在一个麦克风ti>6*(B+其他麦克风ti的和)有,则输出这个麦克风是第几个,没有则输出noise。具体ti的值怎么求已经给出公式了。这样问题就简单了,求出最大的麦克风ti值就可以比较了。具体见代码。
#include <cstdio>#include <cstdlib>#include <cstring>#include <algorithm>#include <iostream>#include <cmath>#include <queue>#include <map>#include <stack>#include <list>#include <vector>using namespace std;#define LL __int64#define ling 0.0000001struct node{double s;int p;}f[100010];int cmp(node a,node b){return a.s>b.s;}double dis(LL x1,LL y1,LL x2,LL y2){return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);}LL b,xx,yy,x,y,s;int main(){double ans;int T,n,i;scanf("%d",&T);while (T--){scanf("%d",&n);scanf("%I64d",&b);scanf("%I64d%I64d",&xx,&yy);ans=0;for (i=0;i<n;i++){scanf("%I64d%I64d%I64d",&x,&y,&s);f[i].s=s/dis(xx,yy,x,y);f[i].p=i+1;ans+=f[i].s;}sort(f,f+n,cmp);double max=6*(b+ans-f[0].s);if ((f[0].s-max>ling))printf("%d\n",f[0].p);else puts("NOISE");}return 0;}
- 湖大训练赛8 Bad Signal
- 湖大训练赛1 Broken Audio Signal
- 湖大训练赛8 Identification Codes
- 湖大训练赛1 Shipuratt
- 湖大训练赛1 Restore Calculation
- 湖大训练赛2 Modified LCS
- 湖大训练赛4 Dwarf Tower
- 湖大训练赛第十场 Battleship
- 湖大训练赛第十场 Electricity
- 湖大训练赛8 Cracking the Safe(24点的游戏)
- 湖大暑假训练赛2:The Stones Game
- 湖大训练赛第十场 Aztec Pyramid
- 湖大训练赛第十场 Deepest Station
- 湖大训练赛第十场 Final Standings
- 训练集--训练赛8
- POJ 2377 Bad Cowtractors(最大生成树,2016河南多校大一训练赛)
- 大重量训练法
- 【大渣】#11月训练赛第1场
- 怎么在xp、win7、win8中快速显示桌面
- bign类C++高精度模板
- 【Leetcode长征系列】Reverse Words in a String
- like查询特殊字符,用转义符处理
- Code Review(二)
- 湖大训练赛8 Bad Signal
- 关于Class.forName()
- id ,NSObject, id<NSObject>区别
- Let's go home+hdu+2sat问题的求解
- Struts2_1_struts2运行环境的搭建
- 工作中的问题解决 -- (win2003 asp.net) Session和带页面回传的方法无法正常使用解决方案
- 《Android 4高级编程》学习摘要
- a^b%c 的三种形式
- Instance method '-copyPath:toPath:handler:' not found (return type defaults to 'id')