水题直接码...

/********************* Template ************************/
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;#define EPS         1e-8
#define MAXN        (int)1e5+50
#define MOD         (int)1e9+7
#define PI          acos(-1.0)
#define LINF        ((1LL)<<50)
#define INF         (1<<30);
#define max(a,b)    ((a) > (b) ? (a) : (b))
#define min(a,b)    ((a) < (b) ? (a) : (b))
#define max3(a,b,c) (max(max(a,b),c))
#define min3(a,b,c) (min(min(a,b),c))
#define BUG         cout<<"BUG! "<<endl
#define LINE        cout<<"--------------"<<endl
#define L(t)        (t << 1)
#define R(t)        (t << 1 | 1)
#define Mid(a,b)    ((a + b) >> 1)
#define lowbit(a)   (a & -a)
#define FIN         freopen("in.txt","r",stdin)
#define FOUT        freopen("out.txt","w",stdout)
#pragma comment     (linker,"/STACK:102400000,102400000")// typedef long long LL;
// typedef unsigned long long ULL;
typedef __int64 LL;
// typedef unisigned __int64 ULL;
// int gcd(int a,int b){ return b?gcd(b,a%b):a; }
// int lcm(int a,int b){ return a*b/gcd(a,b); }/*********************   F   ************************/
struct POINT{double x,y;POINT(double _x = 0, double _y = 0):x(_x),y(_y){};void show(){cout<<x<<" "<<y<<endl;}
}p[MAXN];
double dist(POINT p1,POINT p2){return(sqrt((p1.x-p2.x) * (p1.x-p2.x) + (p1.y-p2.y) * (p1.y-p2.y)));
}
double multiply(POINT sp,POINT ep,POINT op){return (sp.x-op.x) * (ep.y-op.y) - (ep.x-op.x) * (sp.y-op.y);
}
bool ptcmp(POINT a,POINT b){if(multiply(a,b,p[0]) == 0) return dist(p[0],a) < dist(p[0],b);return (multiply(a,b,p[0]) > 0);
}
double Triangle_area(POINT a,POINT b,POINT c){return multiply(a,b,c)/2;
}
char a[1000005];
double ax[10] = {0,-1,0,1,-1,0,1,-1,0,1};
double ay[10] = {0,-1,-1,-1,0,0,0,1,1,1};
int main()
{//FIN;//FOUT;int T;scanf("%d",&T);getchar();while(T--){gets(a);int len = strlen(a);double ans = 0;POINT st = POINT(0,0);for(int i = 0 ; i < len-2 ; i++){POINT st1 = POINT(st.x+ax[a[i]-'0'],st.y+ay[a[i]-'0']);POINT st2 = POINT(st1.x+ax[a[i+1]-'0'],st1.y+ay[a[i+1]-'0']);ans += Triangle_area(POINT(0,0),st1,st2);st = st1;}ans = fabs(ans);printf("%I64d",LL(ans));if((ans - floor(ans)) >= EPS)printf(".5\n");else printf("\n");}return 0;
}

转载于:https://www.cnblogs.com/Felix-F/p/3251038.html

POJ 1654 Area 凸包面积相关推荐

  1. poj 1654 Area 多边形面积

    /* poj 1654 Area 多边形面积题目意思很简单,但是1000000的point开不了 */ #include<stdio.h> #include<math.h> # ...

  2. POJ 3348 Cows 凸包面积

    题目大意:连接个点,求围成的面积并除以50(向下取整) 题目思路:就是求凸包面积:按逆时针方向为凸包上每条边指定方向,对于每条边AB,累加(AXB)/2的值. #include<cstdio&g ...

  3. poj 1654 Area

    #include<iostream> //多边形面积#include<string>using namespace std;struct point{int x,y;}p[10 ...

  4. POJ 3348 Cows(凸包面积)

    有 n 棵树,给出他们的顶点,每头牛的活动范围为 50 平方米,以 n 棵树为顶点围成篱笆,问最多可以容纳多少头牛 求凸包面积模板题 const int N=1e4+5;int i,j,k;int n ...

  5. POJ 1265 Area(Pick定理)

    POJ 1265 Area(Pick定理) 根据pick定理来做 皮克定理是指一个计算点阵中顶点在格点上的多边形面积公式该公式可以表示为 2S=2a+b−2 其中a表示多边形内部的点数,b表示多边形边 ...

  6. 用python批量获取cad中线段点组成的凸包 + 面积

    用python批量获取cad中线段点组成的凸包 + 面积 效率实在太低,还是用c# 吧 import win32com.client import pythoncom import tubao imp ...

  7. poj 3348(求凸包面积)

    题意:一片草地上有n课树,现在你想用绳子圈出一个尽可能大的面积出来养牛.已知每只牛需要50单位的面积,问最多能养几只牛. 解题思路:凸包的面积.这里一般的思路就是先求出凸包,再以最低点为顶点分割n-2 ...

  8. POJ 1389 Area of Simple Polygons(扫描线求面积)

    思路:纯纯扫描线求面积模板题,求点赞qaq. #include<iostream> #include<cstdio> #include<cstring> #incl ...

  9. POJ 1151 Atlantis 矩形面积求交/线段树扫描线

    Atlantis 题目连接 http://poj.org/problem?id=1151 Description here are several ancient Greek texts that c ...

最新文章

  1. 把一列数据分割成两列
  2. puppet kick 功能实现
  3. 如何在Ubuntu系统的顶部标题栏中增加CPU/内存/网速实时监控的小控件
  4. Word2Vec学习笔记(二)
  5. 010.第一个回声服务器可能遇到的问题——connect函数
  6. GD32F103学习笔记(1)——搭建环境、编译烧写
  7. m3u8 ts文件利用系统工具COPY合并序列TS文件
  8. 高手实战!Windows 7开机加速完全攻略
  9. 什么软件可以测试宝宝身高体重,如何测试宝宝身高体重
  10. 网络笔记:路由选路原则
  11. shell(37) : java控制台运行打印颜色字体
  12. MYSQL limt随着offset增大效率变低
  13. 利用Python(pyserial、minimalmodbus、modbus_tk)进行单片机通信
  14. Android静态安全检查(九):不安全的SDCard存储检测
  15. 操作系统实验报告【太原理工大学】
  16. 终极单词index 排序 O-P
  17. 飞信短信接口php,用PHP实现飞信api接口发飞信短信
  18. Vue手把手带你入门(一) nodejs安装配置以及vue-cli脚手架创建第一个vue项目(超级详细)
  19. 机器视觉入门之路(六一,大用图像二值化,从静态到动态)
  20. 软测(五)Web自动化测试下

热门文章

  1. Kubernetes NodePort vs Loadbalancer vs Ingress 在生成中如何选择?
  2. Python装饰器学习(九步入门)
  3. C#设置配置文件与读取配置文件
  4. 理解Promise规范
  5. Error parsing HTTP request header Note: further occurrences of HTTP header parsing errors
  6. Elasticsearch如何关掉服务
  7. 剖析亿级请求下的多级缓存
  8. Spark笔记:RDD基本操作(下)
  9. LRU缓存实现(Java)
  10. ExecutorService-10个要诀和技巧