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 ...
随机推荐
- svn删除所有.svn文件
svn 删除所有的 .svn文件 find . -name .svn -type d -exec rm -fr {} \;
- Bootstrap 表格 笔记
Bootstrap 表格 Bootstrap 提供了一个清晰的创建表格的布局.下表列出了 Bootstrap 支持的一些表格元素: 标签 描述 <table> 为表格添加基础样式. < ...
- 【PHP小项目使用MVC架构】
小项目名称是雇员管理系统. mvc是一种项目的开发模式,中文名称为模式视图控制器,是强制程序员将数据的输入.处理.输出分开的一种开发模式. 在这个小项目中,控制器使用service作为后缀名. 项目u ...
- 【mysql启动Innodb的方法】
点击此处进入原网页 1.存储引擎是什么? Mysql中的数据用各种不同的技术存储在文件(或者内存)中.这些技术中的每一种技术都使用不同的存储机制.索引技巧.锁定水平并且最终提供广泛的不同的功能和能力. ...
- JavaScript中判断对象类型方法大全2
在JavaScript中,有5种基本数据类型和1种复杂数据类型,基本数据类型有:Undefined, Null, Boolean, Number和String:复杂数据类型是Object,Object ...
- POJ1285 Combinations, Once Again(背包 排列组合)
背包解组合数学问题,n种物品,每种num[i]个,求取r个的方法数. 背包思想,f[j]表示当前取j个数的方法数,则状态转移方程为 f[j] += f[k](max(j - num[i], 0) &l ...
- oracle检查点队列(checkpoint queue)
buffer cache CBC链 按地址链 LRU 干净buffer LRUW 脏buffer 按照冷热 checkpoint queue:链buffer,①链脏块②按buffer第一次脏的时 ...
- ThinkPHP的field方法的用法总结
ThinkPHP的连贯操作方法中field方法有很多的使用技巧,field方法主要目的是标识要返回或者操作的字段,下面详细道来. .用于查询 在查询操作中field方法是使用最频繁的. $Model- ...
- ubuntu下整合eclipse和javah生成jni头文件开发android的native程序(转)
本文介绍两种利用javah命令生成jni头文件的方法,第一种为大众所知的javah命令,第二种为整合javah到eclipse里面.推荐第二种方式,方便快捷,随时修改随时生成 0:前提和条件: 1:u ...
- Build better apps: Windows 10 by 10 development series
http://blogs.windows.com/buildingapps/2015/08/05/build-better-apps-windows-10-by-10-development-seri ...