【ZOJ - 2976】Light Bulbs (枚举,暴力)

题干:

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, XiYiZiIi, 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

3
1
0 0 1 100
4
1 0 1 100
0 1 1 100
-1 0 1 100
0 -1 1 100
4
1 0 100 10000
0 1 100 10000
-1 0 100 10000
0 -1 100 10000

Sample Output

100.00
147.43
4.00

题目大意:

   告诉你n个光源的光强和光源的三维坐标,告诉你一个光源投射到地面某一个坐标时,光强的计算公式。告诉你最终地面某一坐标上的光强,就是各光源投影过来的代数和。求地面整点坐标可以达到的最大光强。

解题报告:

   直接暴力就行。

AC代码:

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<set>
#include<string>
#include<cmath>
#include<cstring>
#define ll long long
#define pb push_back
#define pm make_pair
using namespace std;
const int MAX = 2e5 + 5;
const int INF = 0x3f3f3f3f;
int a[MAX];
int num,maxx,maxy,minx,miny;
struct Node {int x,y,z,qd;
} p[MAX];
int main() {int t;cin>>t;while(t--) {scanf("%d",&num);maxx=maxy=-INF;minx=miny=INF;for(int i = 1; i<=num; i++) {scanf("%d%d%d%d",&p[i].x,&p[i].y,&p[i].z,&p[i].qd);maxx = max(maxx,p[i].x);maxy = max(maxy,p[i].y);minx = min(minx,p[i].x);miny = min(miny,p[i].y);}double maxans = 0,ans = 0;for(int i = minx; i<=maxx; i++) {for(int j = miny; j<=maxy; j++) {maxans  = 0;for(int k = 1; k<=num; k++) {double dist = (p[k].x-i)*(p[k].x-i) + (p[k].y-j)*(p[k].y-j) +p[k].z*p[k].z;maxans += (double)p[k].qd /dist * (p[k].z)/sqrt(dist);}ans = max(maxans,ans);}}printf("%.2f\n",ans);}return 0 ;
}

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/440651.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

为什么计算机编程以英语为主,为什么做编程都用英文,中文不行吗?听程序员解释完,总算明白了...

今天我们科普的话题是&#xff1a;为什么做编程都用英文&#xff0c;中文不行吗&#xff1f;听程序员解释完&#xff0c;总算明白了不知道大家最近有没有追过一部电视剧&#xff0c;它是《亲爱的热爱的》&#xff0c;由李现和杨紫主演的。主要讲述了这对情侣发生的浪漫爱情故事…

html的技术标准网站,HTML5标准最新技术预览

已经存在近十年的HTML4已经成为不断发展的Web开发领域的瓶颈&#xff1b;HTML5标准在此时显得尤为重要。每天都有新颖而创新的网站出现&#xff0c;全方位地拓展HTML的边界。Web开发者正在寻求新的技术&#xff0c;提供更强大的功能&#xff0c;那些因为脚本语言和浏览器的限制…

计算机网络技术实验,计算机网络技术实验

计算机网络技术实验 实 验 一 (2课时) 课题(项目)名称: 基本网络命令 计划学时: 2学时 实验目的 1. 了解网络命令的基本使用方法 2. 掌握常用网络命令的应用 3. 掌握网络通达性的基本测试方法 实验要求 1. 全面了解各种网络命令 2. 对常用的网络命令&#xff0c;上机测试运行 3…

html div分钟刷新一次啊代码_接口测试平台代码实现57首页重构5

本节我们接着开发首页&#xff0c;主要内容是 让左侧的请求记录和右侧的请求模块 联动起来。具体联动需求&#xff1a;右侧请求一次之后&#xff0c;左侧生成记录点击左侧记录&#xff0c;右侧则会显示这次记录的请求数据我们本节课的内容是想办法实现1-生成记录。我们知道&…

会计专业领域计算机应用系统,信息技术在会计专业领域中的应用

在当今这个信息时代,信息技术对会计专业产生了重大的变革。本文在详细分析会计信息化特征的基础上,阐述了由于信息技术应用对会计职能产生的影响,并提出了如何更好的在会计专业领域推广信息技术。信息技术在会计专业领域中的应用郑晨(福建农林大学计算机与信息学院&#xff0c;…

固定 顶部_纹络型温室大棚顶部通风样式及效率对比

纹络型温室大棚是一种使用玻璃作为覆盖材料的温室大棚&#xff0c;该种温室大棚由于抗风雪能力强&#xff0c;环境控制能力强、使用年限长&#xff0c;目前在我国的南北地区大量建造。由于该型号的玻璃温室大棚单体占地面积能够达到几十亩地&#xff0c;因此单靠墙面通风无法满…

微型计算机智能体重评测,荣耀智能体脂秤WiFi版评测:17项身体指标 比你更懂你...

原标题&#xff1a;荣耀智能体脂秤WiFi版评测&#xff1a;17项身体指标 比你更懂你[PConline 评测]俗话说冬天不减肥&#xff0c;夏天徒伤悲&#xff0c;每个人都希望拥有穿衣显瘦、脱 衣有肉的完美身材。但往往理想很丰满&#xff0c;现实很骨感&#xff0c;很多人都陷入减肥的…

人脑意识转入量子计算机,人脑产生意识:可能是因为量子纠缠

图片来源&#xff1a;quanta magazine一提到“量子意识”这个词语&#xff0c;大多数物理学家都会选择避而不谈&#xff0c;因为这个词语听起来好像有点“民科”&#xff0c;甚至让人联想宗教或者玄学。不过出人意料的是&#xff0c;量子效应可能真的在人类的认知过程中起到了一…

【ZOJ - 1163】The Staircases(dp)

题干&#xff1a; One curious child has a set of N little bricks. From these bricks he builds different staircases. Staircase consists of steps of different sizes in a strictly descending order. It is not allowed for staircase to have steps equal sizes. Ev…

的级联选择_级联接收机的计算及Y因子噪声因子测量法

对于RF系统工程师来说&#xff0c;计算噪声系数预算对预测产品性能至关重要。一、级联接收机的计算这部分讨论噪声系数的一般概念&#xff0c;以及产品定义和电路设计者如何利用噪声系数表示噪声性能要求。噪声系数也用于预测接收机系统的总体灵敏度。也介绍级联接收机的噪声系…

免费测试英语发音的软件,2020英语音标免费版

2020英语音标免费版是一款安卓手机英语音标内容学习软件&#xff0c;在这里汇集了英语音标相关内容学习&#xff0c;包含了音标、发音等内容学习&#xff0c;能够进行对比练习&#xff0c;不断对比&#xff0c;让发音更标准&#xff0c;拥有详细的发音知识可以学习&#xff0c;…

W10的服务器正在运行,win10开机提示服务器正在运行中的解决教程

今天小编给大家分享的是win10开机提示服务器正在运行中的解决教程。最近有win10的用户反映&#xff0c;在开机的时候莫名的就出现了个“服务器正在运行中”的气泡提示&#xff0c;出现此问题困扰的用户&#xff0c;请来看看下面的解决教程吧。使用win10系统过程中&#xff0c;在…

host ntrip 千寻rtk_最新测量干货:南方银河1和银河1Plus RTK设备连接千寻cors账号的设置方法...

无论刚接触网络RTK的测量员是想要进行华测RTK连接千寻cors账号的操作&#xff0c;还是中海达RTK连接千寻cors账号&#xff0c;亦或者司南RTK连接千寻cors账号的操作&#xff0c;我们在进行cors账号的连接操作之前都应该对操作的RTK设备有一个了解&#xff0c;所以今天我们在给大…

【CodeForces - 1084D】The Fair Nut and the Best Path (树形dp)

题干&#xff1a; The Fair Nut is going to travel to the Tree Country, in which there are nn cities. Most of the land of this country is covered by forest. Furthermore, the local road system forms a tree (connected graph without cycles). Nut wants to rent …

python不同曲线设置标签_【图像分类】基于Pascal VOC2012增强数据的多标签图像分类实战...

接着上一次的多标签分类综述&#xff0c;本文主要以Pascal VOC2012增强数据集进行多标签图像分类训练&#xff0c;详细介绍增强数据集制作、训练以及指标计算过程&#xff0c;并通过代码进行详细阐述&#xff0c;希望能为大家提供一定的帮助&#xff01;作者&编辑 | 郭冰洋…

表字段注释放在哪_橱柜台面6种材质优缺点大解剖,我来测评,告诉你哪一种适合你!...

很多人装修厨房&#xff0c;只知道橱柜要好用&#xff0c;厨房才好用。但在做橱柜的时候&#xff0c;除了橱柜的选择&#xff0c;很多装修新手还会遇到一些其他疑问&#xff1a;① 橱柜的台面用什么材质的比较好&#xff1f;② 台面的挡水条到底要不要做&#xff1f;③ 橱柜台面…

【Kattis - triangle 】Sierpiński Circumference(数学,求位数,取对数或Java)

题干&#xff1a; Polish mathematician Wacław Sierpiński (1882-1969) described the 2D geometric figure known as the Sierpiński triangle as part of his work on set theory in 1915. The triangle, which is really an infinite collection of points, can be con…

米莱狄的机器人是_王者荣耀2.22更新:米莱狄机器人化身超级兵,狂铁将成T1级战士...

王者荣耀体验服在刚刚迎来了一次小更新&#xff0c;主要针对两位海都英雄的调整&#xff0c;这也是米莱狄和狂铁自上回加强后获得的第二波BUFF&#xff0c;一起来看看这次调整能否让这两位冷门英雄成为上分首选吧&#xff01;狂铁在上回的调整中移除了大招护盾伤害和汲取能量的…

如何云服务器销售,如何云服务器销售

如何云服务器销售 内容精选换一换云耀云服务器(Halo Elastic Cloud Server&#xff0c;HECS)是可以快速搭建简单应用的新一代云服务器&#xff0c;具备独立、完整的操作系统和网络功能。提供快速地应用部署和简易的管理能力&#xff0c;适用于网站搭建、开发环境等低负载应用场…

中原标准时间对时_GPS对时系统(时间同步系统)应用电子政务

GPS对时系统&#xff08;时间同步系统&#xff09;应用电子政务GPS对时系统&#xff08;时间同步系统&#xff09;应用电子政务摘要&#xff1a;随着电子政务的不断发展&#xff0c;许多省份都建立了自己的政务网络&#xff0c;使用的网络设备和服务器日益增多&#xff0c;这些…