标签:style blog http color os io for art
题目链接:http://acm.hnu.cn/online/?action=problem&type=show&id=12885&courseid=274
解题报告:一共有n个发射装置,有一个接收装置,接收装置能够正确接收并把接收到的信号准确的译码出来的条件是:
Ti > 6 * (B +(T1 + T2 + .... Ti-1 + Ti+1.....Tn))
然后Ti = si / (Pi - p)
si是信号强度
pi - p的意思是发射器跟接收器之间的直线距离的平方
暴力模拟就行了
1 #include<cstdio> 2 #include<cstring> 3 #include<iostream> 4 #include<algorithm> 5 #include<map> 6 #include<string> 7 #include<cmath> 8 using namespace std; 9 #define maxn 100005 10 struct node 11 { 12 int si,x,y; 13 double t; 14 }que[maxn]; 15 int main() 16 { 17 int T,n,B,x,y; 18 scanf("%d",&T); 19 while(T--) 20 { 21 scanf("%d",&n); 22 scanf("%d%d%d",&B,&x,&y); 23 double tot = 0; 24 for(int i = 1;i <= n;++i) 25 { 26 scanf("%d%d%d",&que[i].x,&que[i].y,&que[i].si); 27 que[i].t = 1.0 * que[i].si / ((que[i].x - x)*(que[i].x - x) + (que[i].y - y) * (que[i].y - y)); 28 tot += que[i].t; 29 } 30 int l = 0; 31 for(int i = 1;i <= n;++i) 32 { 33 double temp = 6 * (B + tot - que[i].t); 34 if(que[i].t > temp) 35 { 36 l = i; 37 break; 38 } 39 } 40 printf(l? "%d\n":"NOISE\n",l); 41 } 42 return 0; 43 }
HNU 12885 Bad Signal(模拟),布布扣,bubuko.com
标签:style blog http color os io for art
原文地址:http://www.cnblogs.com/xiaxiaosheng/p/3903408.html