链接

几何的简单题,建立坐标,判断相等以及不共线

 #include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
#include<vector>
#include<cmath>
#include<queue>
#include<set>
using namespace std;
#define N 200
#define LL long long
#define INF 0xfffffff
const double eps = 1e-;
const double pi = acos(-1.0);
const double inf = ~0u>>;
char s[N],sr[];
struct Point
{
double x,y;
Point(double x=,double y=):x(x),y(y) {}
}p[N];
vector<Point>ed[];
typedef Point pointt;
pointt operator + (Point a,Point b)
{
return Point(a.x+b.x,a.y+b.y);
}
pointt operator - (Point a,Point b)
{
return Point(a.x-b.x,a.y-b.y);
}
int dcmp(double x)
{
if(fabs(x)<eps) return ;
else return x<?-:;
}
double dis(Point a)
{
return sqrt(a.x*a.x+a.y*a.y);
}
double cross(Point a,Point b)
{
return a.x*b.y-a.y*b.x;
}
double mul(Point p0,Point p1,Point p2)
{
return cross(p1-p0,p2-p0);
}
int main()
{
int n,i,j,g,e;
while(scanf("%d",&n)&&n)
{
getchar();
for(i = ; i < ; i++)
ed[i].clear();
for(i = ; i <= n*(n+)/; i++)
scanf("%c",&s[i]);
int g = ;
double tx=n,ty = sqrt(3.0)*(n-);
for(i = ;i <= n; i++)
{
double x0 = tx-i+;
double y0 = ty-(i-)*sqrt(3.0);
for(j = ; j <= i ;j++)
{
Point pp;
pp.y = y0;
pp.x = x0;
x0+=;
g++;
ed[s[g]-'a'].push_back(pp);
}
}
int cnt = ;
for(i = ; i < ; i++)
{
if(ed[i].size()<) continue;
int k = ed[i].size();
for(j = ;j < k ; j++)
for(g = j+ ; g < k ; g++)
for(e = g+ ; e < k ; e++)
{
Point p1 = ed[i][j],p2 = ed[i][g],p3 = ed[i][e];
// cout<<p1.x<<" "<<p1.y<<" "<<p2.x<<" "<<p2.y<<" "<<p3.x<<" "<<p3.y<<endl;
// cout<<i<<" "<<dis(p1-p2)<<" "<<dis(p1-p3)<<" "<<dis(p2-p3)<<endl;
if(dcmp(dis(p1-p2)-dis(p1-p3))==&&dcmp(dis(p1-p2)-dis(p2-p3))==&&dcmp(mul(p1,p2,p3))!=)
{
sr[cnt++] = i+'a';
}
}
}
if(cnt==)
{
puts("LOOOOOOOOSER!");
continue;
}
for(i = ; i < cnt ; i++)
printf("%c",sr[i]);
puts("");
}
return ;
}

poj1244Slots of Fun的更多相关文章

随机推荐

  1. HDU 2444:The Accomodation of Students(二分图判定+匹配)

    http://acm.hdu.edu.cn/showproblem.php?pid=2444 题意:给出边,判断这个是否是一个二分图,并求最大匹配. 思路:先染色法求出是否是一个二分图,然后再匈牙利求 ...

  2. pgadmin(IDE)工具连接postgres数据库

    1. 下载软件        软件地址:http://www.pgadmin.org/download/pgagent.php   2.安装软件    安装过程:略    打开软件64位会出现  “无 ...

  3. ORACLE--分区表数据清理

    由于分区表数据增加:没做清除操作:导致表空间告急.需要清理很久之前的数据:释放空间.步骤如下 一,查看哪个表占的空间 SELECT t.segment_name, SUM(t.bytes / 1024 ...

  4. https协议操作

    在伪静态中加入下列代码 <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{SERVER_PORT} 80 RewriteRul ...

  5. C4D to Unity3D插件C2U Tool开源发布!简化你的工作流

    Unity早期有对.c4d文件进行支持,但缩放问题,不支持顶点色,以及目标机器必须安装C4D等都极为蛋疼,这是这款工具开发的初衷之一.C2U工具解决了传统FBX导出的诸多问题,以及脚本链接,Shade ...

  6. JAVA基础知识之多线程——控制线程

    join线程 在某个线程中调用其他线程的join()方法,就会使当前线程进入阻塞状态,直到被join线程执行完为止.join方法类似于wait, 通常会在主线程中调用别的线程的join方法,这样可以保 ...

  7. 推荐一款非常棒的谷歌插件---快速查看HTML页面元素的CSS样式

    一.下载地址 http://chromecj.com/web-development/2015-05/456/download.html 二.简介 CssViewer是一款快速查看当前页面元素的CSS ...

  8. Duilib创建窗口双击标题栏禁止窗口最大化

    使用Duilib创建窗口并禁止窗口最大化 第一步: XXXFrame.Create(NULL, _T("XXXFrame"), UI_WNDSTYLE_EX_FRAME, WS_E ...

  9. Android 路径大全

    1 内部存储路径为/data/data/youPackageName/ 目录结构 //返回cache文件对象 this.getCacheDir(); //返回databases下指定文件 this.g ...

  10. CodeForces 483B Friends and Presents

     Friends and Presents Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I ...