POJ 1654 Area(水题)
卡了一下精度和内存。
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;
#define eps 1e-8
#define N 1000001
#define LL __int64
int a[] = {-,,,-,,,-,,};
int b[] = {-,-,-,,,,,,};
char str[N];
LL cross(LL x1,LL y1,LL x2,LL y2)
{
return x1*y2 - x2*y1;
}
int main()
{
int t,len,i;
LL x,y,ans,px,py;
scanf("%d",&t);
while(t--)
{
scanf("%s",str);
len = strlen(str);
px = ;
py = ;
ans = ;
for(i = ;i < len;i ++)
{
if(str[i] == '')break;
x = px+a[str[i]-''-];
y = py+b[str[i]-''-];
ans += cross(x,y,px,py);
px = x;
py = y;
}
ans += cross(px,py,,);
if(ans < ) ans = -ans;
if(ans% == )
printf("%I64d\n",ans/);
else
printf("%I64d.5\n",ans/);
}
return ;
}
POJ 1654 Area(水题)的更多相关文章
- 【转】POJ百道水题列表
以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...
- poj 1654 Area 多边形面积
/* poj 1654 Area 多边形面积 题目意思很简单,但是1000000的point开不了 */ #include<stdio.h> #include<math.h> ...
- poj 1654 Area (多边形求面积)
链接:http://poj.org/problem?id=1654 Area Time Limit: 1000MS Memory Limit: 10000K Total Submissions: ...
- 2018.07.04 POJ 1654 Area(简单计算几何)
Area Time Limit: 1000MS Memory Limit: 10000K Description You are going to compute the area of a spec ...
- poj 3264 RMQ 水题
题意:找到一段数字里最大值和最小值的差 水题 #include<cstdio> #include<iostream> #include<algorithm> #in ...
- Poj 1552 Doubles(水题)
一.Description As part of an arithmetic competency program, your students will be given randomly gene ...
- POJ 1654 Area 凸包面积
水题直接码... /********************* Template ************************/ #include <set> #include < ...
- poj 1654 Area(求多边形面积 && 处理误差)
Area Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 16894 Accepted: 4698 Description ...
- poj 1654 Area(多边形面积)
Area Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 17456 Accepted: 4847 Description ...
随机推荐
- javascript 面向对象编程小记
虽然平常用jquery用的很熟,但是基本都是面向过程的写法.一个事件一个function,很少有面向对象的写法.今天得写一个日期控件,不得不用上面向对象编程. 刚开始我的想法是: var datepi ...
- HTML5学习之视频与音频(三)
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...
- 【转载】 Python动态生成变量
用Python循环创建多个变量, 如创建 a1= .a2= .a3= .a4= .a5= 或 self.a1= .self.a2= . self.a3= 一. 可以通 ...
- EXCEL中汉字转大写拼音
最近一直没有什么成系统的学习东西,也就没写什么随笔.昨天晚上,一哥们儿说给弄个输入汉字直接转拼音的程序,问了他几点需求,说你想做个啥的,最后,他说想做个EXCEL的,现在发现EXCEL确实是个好东西啊 ...
- C#调用ArcGIS REST服务
ArcGIS REST API提供了简单.开放的接口来访问和使用ArcGIS Server发布的服务.使用ArcGIS REST API通过URL可以获取和操作每一个服务中的所有资源和操作. 1.使用 ...
- 怎样在linux下安装网卡驱动
由于我电脑的各种奇葩问题的存在,导致我装上Ubuntu13.10之后网卡居然无法使用,坚持了挺久使用无线网,终于坚持不住了,百度了各种解决方式,终于成功解决.这里也记录一下我的解决过程,供大家参考.大 ...
- hdu 4046 2011北京赛区网络赛G 线段树 ***
还带这么做的,卧槽,15分钟就被A了的题,居然没搞出来 若某位是1,则前两个为wb,这位就是w #include<cstdio> #include<cstring> #defi ...
- 1080P、720P、4CIF、CIF所需要的理论带宽
转自:http://blog.sina.com.cn/s/blog_64684bf30101hdl7.html 在视频监控系统中,对存储空间容量的大小需求是与画面质量的高低.及视频线路等都有很大关系. ...
- I帧 B帧 p帧 IDR帧的区别
转自:http://blog.csdn.net/sphone89/article/details/8086071 IDR(Instantaneous Decoding Refresh)--即时解码刷新 ...
- winows下使用ssh服务远程登录vbox中的虚拟机
1.到http://www.putty.org/下载并安装SSH客户端 2.查看是否安装ssh服务 在ubuntu终端命令界面键入: #ssh localhost 如果出现下面提示则表示还没有安装: ...