集训队作业解题报告_第1页
集训队作业解题报告_第2页
免费预览已结束,剩余1页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、题目来源Ural 1583 Cheese问题描述有一块 100*10*10 的 Cheese,里面有若干球状小洞在 cheese。现在要求一个每一刀都垂直于长轴的切割方案,使得每切下的一块体积都是 500。最后一块除外。算法二分。故只需计算 f(x),其中 x 是距离起点的距离即可。切下的球冠的体积公式与URAL1562 一致,这里不再叙述。算法证明公式的证明见URAL1562 解题。算法实现题目中要求,每个输出的距离精确到 6 位小数。但一点需要注意,题目要求的是使得f(x)最接近 500k 的 x,而并非使得 x 最接近 x0 的 x。(f(x0)=500k)源代码const maxn=3

2、00; var n,i,m:long;v,cc:extended;:array1.maxnof extended; ll,rr,mid:extended;ans:array0.20of long;function solve(x:extended):extended;var ans,d,s:extended;i:longbegin;ans:=10*10*x; for i:=1 to n doif yi+rixthen ans:=ans-4/3*pi*ri*ri*ri else if yi-ri1e-6 do beginmid:=(rr+ll)/2; v:=solve(mid);if vcc t

3、hen rr:=mid else ll:=mid; end;ansi:=trunc(ll*10000);if abs(solve(ansi/10000)-cc)abs(solve(ansi+1)/10000)-cc) then inc(ansi);end;if ansm=1000000then begin wrin(m-1); for i:=1 to m-1 do wrin(ansi); endelse begin wriend.n(m);for i:=1 to mdo wrin(ansi) end;原题描述:1583. CheeseTime Limit: 1.0 second Memory

4、Limit: 64 MBPlus il y a de fromage, plus il or plus il y a de trous, moins il y donc plus il y a de fromage, moins il yy a aa de trous de fromage de fromage lemmentalParadoxe deProgrammer Sasha went downhill skiinghe Swiss Alps thimmer. erested t Swiss le, theySwitzerland is famous for its bs and ch

5、eese. Sasha was notin bs, but he visited a cheese factory. He learned therepeople treated cheese even more seriouslyn money. For expheeseo vacuum packs in pieof exactly 500 grams. If you thinkt it is very easy to cut off such pie, then you are mistaken: thereare holes in Swiss cheese, whi modern tec

6、hnologies make it location of all cavities in aust be takeno account. Fortunay,sible to determine exactly the size and piece of cheese.Cheese is fed to a cutting machine as a long bar of square section 1010cm and length 1 m. Amet all cavities are spherical and do notersect each other and the borders

7、 of the bar. The machine can cut the bar at right angle to the long edges using a micrometer scale (t is, a grid of size 1 m). A spel computer determines the value the coordinate along the long edge of the bar at which a cut should be madesot the weight of the next piece be exactly 500 grams. This v

8、alue isrounded to micrometers and the machine cuts the bar. Then the computer determines where the next cut should be made, and so on, until the weightof the remaining piece is lessn 500 grams. If it turns outt thelast cut should be made at the coordinate of exactly 1 meter, then, of course, this cu

9、t is not made.Write a programt determines the coordinates of the cuts exactly asthe Swiss computer does.Inputline contains the number n of cavities in a bar of cheese (0The nyi zi 100). The next n lines describe these cavitieshe formatxiri,(xi, yi, zi)whereare the coordinates of the center of aandis

10、 its radius. The size of the bar is 1010010 along the x, y, and z axes, respectively. The coordinate origin is one of the corners ofrithe bar; the unit of measure is 1 cm. It is knownt 1 cm3 of Swiss cheese weighs 1 gram.OutputOutput the coordinates of the cuts on the scale of the cutting machine.heline output the numberof cuts, and icrometershe following linesgive the coordinates ofthecutsmeasuredfromthebeginningofthebar.SleProblem ProblemAuthor: AlexanderMironenko(prepared by Denis Musin)Source:ACM ICPC 20072008. NEERC. Eastern Subregion.Yekaterinburg, Oc

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论