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 ...
随机推荐
- CC2530红外学习球学码函数(P1.2接红外一体接收头,使用定时器tim1的复用功能2)
P1.2GPIO配置: void cap_gpio_init(){ P1SEL |= 0x04; P1DIR &= ~0x04; PERCFG |= 0x40; P2SEL |= 0x20; ...
- HOG detectMultiScale 参数分析
前段时间学习了HOG描述子及其与SVM结合在行人检测方面的应用. 当我们用训练好的模型去检测测试图像时,我们会用到detectMultiScale() 这个函数来对图像进行多尺度检测. 这是openc ...
- cf B. Little Dima and Equation
http://codeforces.com/contest/460/problem/B import java.util.*; import java.math.*; public class Mai ...
- XJOI网上同步训练DAY1 T3
思路:一开始看到这题的时候想DP,可是发现貌似不行..因为有前缀也有后缀,而且有的后缀会覆盖到现在的前缀,这就不满足无后效性了啊! 但是有个很巧妙的思路:如果我们知道a[i]的最大值,那么p的数量和q ...
- yii基础知识-
控制器 是 CController 或其子类的实例.它在当用户请求时由应用创建. 当一个控制器运行时,它执行所请求的动作,动作通常会引入所必要的模型并渲染相应的视图. 动作 的最简形式,就是一个名字以 ...
- [转]ReactJS入门教程
Refference From:http://www.cocoachina.com/webapp/20150721/12692.html 现在最热门的前端框架有AngularJS.React.Boot ...
- 插入排序(Insertion Sort)
这是排序算法中最常见的排序方法,也是初学者使用最多的.有时候我们在生活中也会不自觉地用到插入排序,例如: 给手里的牌排序 这是最常见的例子之一,我们通常从纸牌的一边开始看,找到一张位置不正确的,把它拿 ...
- Hdu2860-Regroup(种类并查集)
Problem Description When ALPC42 got to a panzer brigade, He was asked to build software to help them ...
- linux之getcwd函数解析
[lingyun@localhost getcwd]$ cat getcwd.c /********************************************************** ...
- 平时的笔记04:处理stagger模块
#! /usr/bin/env python3 # # __init__.py # From the stagger project: http://code.google.com/p/stagger ...