1010 Area
题目要求面积和判断非相邻边不相交。和数学和几何有关系。
#include <stdio.h>
#include <math.h>
#define MISS 0.0000001
int det(double x1,double y1,double x2,double y2,double x3,double y3){
double w1,w2;
w1=x1*y2+x2*y3+x3*y1;
w2=x2*y1+x3*y2+x1*y3;
if(fabs(w1-w2)<MISS)
;
else if(w1>w2)
;
else if(w1<w2)
;
}
int main(){
,temp;
],y[],area;
while(scanf("%d",&n)&&n){
count++;
)
printf("\n");
printf("Figure %d: ",count);
;i<n;i++)
scanf("%lf%lf",&x[i],&y[i]);
){
printf("Impossible\n");
continue;
}
;i<n;i++){
)/n;j<i-;j++){
temp=(i+)%n;
],y[j+])*det(x[j],y[j],x[temp],y[temp],x[j+],y[j+])<=&&
det(x[i],y[i],x[j],y[j],x[temp],y[temp])*det(x[i],y[i],x[j+],y[j+],x[temp],y[temp])<=){
printf("Impossible\n");
goto quit;
}
}
}
area=;
;i<n;i++)
area+=x[i]*y[(i+)%n]-y[i]*x[(i+)%n];
printf();
quit:;
}
;
}
1010 Area的更多相关文章
- [ZJU 1010] Area
ZOJ Problem Set - 1010 Area Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge Jer ...
- [ZOJ 1010] Area (计算几何)
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1010 题目大意:给你n个点,问你顺次连线能否连成多边形?如果能, ...
- zoj 1010 Area【线段相交问题】
链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1010 http://acm.hust.edu.cn/vjudge/ ...
- POJ题目细究
acm之pku题目分类 对ACM有兴趣的同学们可以看看 DP: 1011 NTA 简单题 1013 Great Equipment 简单题 102 ...
- 【转】POJ百道水题列表
以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...
- ACM 计算几何向量
向量 简介注意事项基本计算 加减法 ~ 示例代码 长度 ~ 示例代码 数乘 ~ 示例代码 点积 应用 ~ 示例代码 叉积 ~ 示例代码 性质与应用 经典题目 向量旋转 操作目的 模板代码 简介 向量, ...
- SPOJ CIRU The area of the union of circles (计算几何)
题意:求 m 个圆的并的面积. 析:就是一个板子题,还有要注意圆的半径为0的情况. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024 ...
- [转]NopCommerce How to add a menu item into the administration area from a plugin
本文转自:http://docs.nopcommerce.com/display/nc/How+to+code+my+own+shipping+rate+computation+method Go t ...
- BZOJ 1010: [HNOI2008]玩具装箱toy [DP 斜率优化]
1010: [HNOI2008]玩具装箱toy Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 9812 Solved: 3978[Submit][St ...
随机推荐
- log4j日志分模块打印,同时不打印到控制台上
由于定时刷新程序的启用,导致catalina.out配置文件中打入大量日志,致使程序调试困难. 无法正常查看日志.所以客户要求将性能流量配置日志迁移出catalina.out目录.修 ...
- AJAX实例入门
一.开门见山 这些时间,瞎子也看得见,AJAX正大踏步的朝我们走来.不管我们是拥护也好,反对也罢,还是视而不见,AJAX像一阵潮流,席转了我们所有的人. 关于AJAX的定义也好,大话也好,早有人在网上 ...
- back_insert_iterator和iterator用起来不一样。
先看代码: #include<iostream> #include<vector> #include<algorithm> #include<iterator ...
- Best Meeting Point 解答
Question A group of two or more people wants to meet and minimize the total travel distance. You are ...
- bootstrap 兼容IE8设置
<!--[if lt IE 9]> <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js" ...
- PHP二分查找(递归和循环)
二分查找可以通过递归和循环来实现, 思路如下: 将要查找的数和中间数进行比较, 如果相等,则表示找到,返回下标 如果要查找的数小于中间这个数,则说明要查找的数分布在数组左边,修改right边界,使其等 ...
- 编码规范(HTML)
code { font-family: "PT Mono", Menlo, "Courier New", monospace; padding: 2px 4px ...
- hdu4267 A Simple Problem with Integers
A Simple Problem with Integers Time Limit: 5000/1500 MS (Java/Others) Memory Limit: 32768/32768 K (J ...
- Oracle sga、pga介绍改动
oracle推荐OLTP(on-line TransactionProcessing)系统oracle占系统总内存的80%,然后再分配80%给SGA,20%给PGA.也就是 SGA=system_to ...
- 显示器 RUIGE瑞鸽高清显示器TL-S1700HD
版权声明:本文博客琅邪工作室原创文章,博客,未经同意不得转载.