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 ...
随机推荐
- Linux系统启动过程分析
[原创]Linux系统启动过程分析-wjlkoorey258-ChinaUnix博客http://blog.chinaunix.net/uid-23069658-id-3142047.html 经过对 ...
- Datagard產生gap
本文轉載自無雙的小寶的博客:http://www.cnblogs.com/sopost/archive/2010/09/11/2190085.html 有時候因為網路或備份故障等原因,主機所產生的歸檔 ...
- PHP5中使用PDO连接数据库的方法
PDO(PHP Data Object) 是PHP 中加入的东西,是PHP 5新加入的一个重大功能,因为在PHP 5以前的php4/php3都是一堆的数据库扩展来跟各个数据库的连接和处理,php_my ...
- 利用Browser Link提高前端开发的生产力
(此文章同时发表在本人微信公众号"dotNET每日精华文章",欢迎右边二维码来关注.) 题记:Browser Link是VS 2013开始引入的一个强大功能,让前端代码(比如Ang ...
- c中malloc的用法
转自:http://blog.sina.com.cn/s/blog_966f8e8501010if7.html Malloc 向系统申请分配指定size个字节的内存空间.返回类型是 void* 类型. ...
- 利用Visual GDB在Visual Studio中进行Android开发
转载请注明http://www.cnblogs.com/adong7639/p/4119467.html 无意中发现了Visual GDB这个工具,可以再Visual Studio中进行Android ...
- strcmp函数的使用
Action() { /********************************* * Author:旺仔 * object:strcmp * date:2015-12-09 ...
- Laravel错误与日志处理
App\Exceptions\Handler class is where all exceptions triggered by your application are logged and th ...
- 2016.5.27 Kal系统安装到U盘的方法,U盘启动Kali
本文我们聊一下如何把Kali Linux安装到移动硬盘或者U盘上,由移动硬盘独立引导,与本地系统完全隔离.U盘随身携带,只要PC的Bios支持USB启动,走到哪都可以使用自己的移动系统,方便工作和学习 ...
- 浩瀚技术助力批发零售商户实现PDA移动POS打印扫描进销存信息化管理
批发零售商户其各门店销售品种多,销售量大,在市场上占据巨大的份额,随着各门店的不断扩展,基层的销售管理并不尽如意,传统的进销存管理软件安装在PC端,无法满足有现有的业务支撑,面对当前现状,移动进销存管 ...