博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
哈理工2015 暑假训练赛 zoj 2976 Light Bulbs
阅读量:7042 次
发布时间:2019-06-28

本文共 3243 字,大约阅读时间需要 10 分钟。

Light BulbsTime Limit:2000MS    Memory Limit:65536KB    64bit IO Format:%lld & %llu

Description

Wildleopard had fallen in love with his girlfriend for 20 years. He wanted to end the long match for their love and get married this year. He bought a new house for his family and hired a company to decorate his house. Wildleopard and his fiancee were very satisfied with the postmodern design, except the light bulbs. Varieties of light bulbs were used so that the light in the house differed a lot in different places. Now he asks you, one of his best friends, to help him find out the point of maximum illumination.

To simplify the problem, we can assume each bulb is a point light source and we only need to consider the grid points of the flat floor of the house. A grid point is a point whose coordinates are both integers. The length and the width of house can be considered infinite. Illumination means the amount of light that go through in one unit area. The illumination of a point can be calculated by simply adding the illumination from each source. The illumination from a source can be calculated by the following equation:

, where
E is the illumination of the point,
I is the luminous intensity of the source,
R is the distance between the source and the point and
i is the angle between the normal of the plane and the light to the point.

Given the position and the luminous intensity of the light bulbs, you are asked to find the maximum illumination on the floor at the grid points.

Input

Standard input will contain multiple test cases. The first line of the input is a single integer T (1 <= T <= 20) which is the number of test cases. And it will be followed by T consecutive test cases.

The first line of each test case contains one integer n(1 <= n <= 100), indicating the number of bulbs of the lamps in the house. The next n lines will contain 4 integers each, Xi, Yi, Zi, Ii, separated by one space, indicating the coordinates and the luminous intensity of the i-th bulb of the lamp. The absolute values of the coordinates do not exceed 100 and Zi is always positive. Ii is a positive integer less than 32768.

Output

Results should be directed to standard output. The output of each test case should be a real number rounded to 0.01, which is the maximum illumination on the floor at the grid points.

Sample Input

310 0 1 10041 0 1 1000 1 1 100-1 0 1 1000 -1 1 10041 0 100 100000 1 100 10000-1 0 100 100000 -1 100 10000

Sample Output

100.00147.434.00这个大水题啊 赛后迅速1 a  只是有啥用啊  ~  当时由于少看了一个条件。他给定了枚举范围 ,那么这就好办了…… 仅仅需枚举-100  到100 矩形区域内的点就可以另外注意坐标系建立的时候不能使下标为负。那么我们就能够把原点建在(-100。100)上。然后三重循环搞定。 
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;const int INF=102;double cnt[2*INF+5][2*INF+5];double A(double x){ return x*x;}double dis(double x1,double y1,double z1,double x2,double y2,double z2 ){ return sqrt(A(x1-x2)+A(y1-y2)+A(z1-z2));}int main(){ int t;cin>>t; while(t--) { memset(cnt,0,sizeof(cnt)); int n;cin>>n; for(int i=0;i

转载于:https://www.cnblogs.com/clnchanpin/p/6852973.html

你可能感兴趣的文章
webservice之入门一
查看>>
HTML5服务器推送消息
查看>>
CNIT消息:2014年7月中国移动搜索市场研究报告
查看>>
宏正ATEN发行全球首款Cat 5双滑轨19寸LCD KVM切换器
查看>>
consui(二)集群配置
查看>>
Windows Cluster 常用命令
查看>>
AndroidStudio生成jar、so、aar以及上传远程库jcenter
查看>>
Redis 过期键的设置、获取和删除过期时间
查看>>
我的友情链接
查看>>
word,excel,网页上如何打x的n次方
查看>>
Cacti(系统监控)
查看>>
Ubuntu 12.04 修改/etc/resolv.conf重启后还原成修改前状态解决办法
查看>>
我的友情链接
查看>>
Spring集成Quartz定时任务
查看>>
ListView的几种常见的优化方法(三)
查看>>
简约设计中的规律—色彩(一)
查看>>
JavaSE 学习参考:访问修饰符
查看>>
AsyncTask异步任务请求的流程
查看>>
Linux Shell脚本编程--cut命令
查看>>
利用Python 程序实现Linux 网卡 bonding 实现
查看>>