1179. Extrusion
来源:互联网 发布:8101e网卡驱动 mac 编辑:程序博客网 时间:2024/06/08 10:04
1179. Extrusion
The Acme Extrusion Company specializes in the production of steel bars with custom-designed cross-sections. The manufacturing process involves cutting a hole in a thick metal plate, the shape of the hole being determined by the customer's specifications.
Molten metal is then forced through the hole to form a long bar. The shape of the hole determines the shape of the cross-section of the resulting bar.
Given a description of a polygonal hole and the volume of molten metal available, determine how long a bar can be formed by this process.
Input consists of one or more data sets consisting of the following information:
- An integer, N , indicating the number of vertices making up the polygon. End of input is signaled by any N less than 3.
- Next are N lines, each containing a pair of floating-point numbers, (xi, yi) , each denoting one vertex of the polygon. Vertices will be presented in clockwise order (relative to the closest interior point) proceeding around the perimeter of the polygon. The xiand yi values are in units of meters.
- The data set is terminated by a floating point value indicating the amount of molten metal available (in cubic meters).
4 0.0 0.0 0.0 0.1 0.1 0.1 0.1 0.0 1.0 7 0.5 1.25 0.9 1.6 0.9 1.1 0.85 1.0 0.9 0.85 0.9 0.5 0.5 0.75 100.0 0
BAR LENGTH: 100.00 BAR LENGTH: 318.73
给出n个点,按顺时针顺序连接组成一个多边形,求它的面积,然后根据给出的体积,求高。
主要是求多边形面积
公式:|(x2*y1-y2*x1+x3*y2-y3*x2+…+x1*yn-y1*xn)|/2
#include<iostream>#include<algorithm>#include<iomanip>using namespace std;int main(){ double x,y,x0,y0,x1,y1; int n; double tiji; while(cin>>n) { if(n==0) return 0; cin>>x>>y; x0=x; y0=y; double note=0; for(int i=1;i<n;i++) { cin>>x1>>y1; note+=x1*y-y1*x; x=x1; y=y1; } note+=x0*y-y0*x; cin>>tiji; double re=tiji*2/note; cout<<"BAR LENGTH: "; cout << fixed << setprecision(2) << re << endl; } system("pause"); return 0;}
- 1179. Extrusion
- 1179. Extrusion
- 1179. Extrusion (多边形面积)
- Hoj 2183 Extrusion
- POJ 2812 Extrusion 笔记
- microstation level3 11 extrusion exercise
- ZAM 3D入门教程(4):Extrusion编辑器
- microstation level3 13 extrusion with span
- 挤压造型Extrusion的节点说明和应用实例
- TOJ 1179.Game of Connections(大数模板)
- SDNU 1179.金明的预算方案【NOIP 2006 提高组】【背包问题】【7月30】
- netfilter1
- Linux 常用命令
- 在android中c c++代码中添加自定义的log
- 在EditText中插入表情图片
- linux内核input子系统解析
- 1179. Extrusion
- MyEclipse下的Debug调试
- VB.net强制结束指定进程
- u-boot一些关键命令的实现详解
- linux驱动子系统之输入子系统(5)
- 利用行SCN实现表变化跟踪
- USB协议学习笔记
- 清理正在使用的资源
- java中实际运用之-Flyweight享元模式(实现多享元模式结构)