题目传送门

 /*
好吧,我不是地球人,这题只要判断正方形就行了,正三角形和正五边形和正六边形都不可能(点是整数)。
但是,如果不是整数,那么该怎么做呢?是否就此开启计算几何专题了呢
*/
/************************************************
* Author :Running_Time
* Created Time :2015-8-8 19:54:14
* File Name :B.cpp
************************************************/ #include <cstdio>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <bitset>
#include <cstdlib>
#include <ctime>
using namespace std; #define lson l, mid, rt << 1
#define rson mid + 1, r, rt << 1 | 1
typedef long long ll;
const int MAXN = ;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + ;
struct Point {
int x, y;
}p[MAXN];
int id[];
int n, tot; int cal_dis(int x1, int y1, int x2, int y2) {
return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
} bool judge(void) {
int tt = ; int d[];
for (int i=; i<=; ++i) {
for (int j=i+; j<=; ++j) {
d[++tt] = cal_dis (p[id[i]].x, p[id[i]].y, p[id[j]].x, p[id[j]].y);
}
}
sort (d+, d++tt);
for (int i=; i<=; ++i) if (d[i] != d[i+]) return false;
if (d[] != d[]) return false;
if (d[] != d[] * ) return false;
return true;
} void DFS(int s, int num) {
if (num == ) {
if (judge ()) tot++;
return ;
}
for (int i=s+; i<=n; ++i) {
id[num+] = i;
DFS (i, num + );
}
} void work(void) {
tot = ;
DFS (, );
printf ("%d\n", tot);
} int main(void) { //BestCoder Round #50 (div.2) 1002 Run
while (scanf ("%d", &n) == ) {
for (int i=; i<=n; ++i) {
scanf ("%d%d", &p[i].x, &p[i].y);
}
if (n < ) {
puts (""); continue;
}
work ();
} return ;
}

简单几何(水)BestCoder Round #50 (div.2) 1002 Run的更多相关文章

  1. BestCoder Round #50 (div.1) 1002 Run (HDU OJ 5365) 暴力枚举+正多边形判定

    题目:Click here 题意:给你n个点,有多少个正多边形(3,4,5,6). 分析:整点是不能构成正五边形和正三边形和正六边形的,所以只需暴力枚举四个点判断是否是正四边形即可. #include ...

  2. DP BestCoder Round #50 (div.2) 1003 The mook jong

    题目传送门 /* DP:这题赤裸裸的dp,dp[i][1/0]表示第i块板放木桩和不放木桩的方案数.状态转移方程: dp[i][1] = dp[i-3][1] + dp[i-3][0] + 1; dp ...

  3. BestCoder Round #50 (div.1) 1003 The mook jong (HDU OJ 5366) 规律递推

    题目:Click here 题意:bestcoder 上面有中文题目 分析:令f[i]为最后一个木人桩摆放在i位置的方案,令s[i]为f[i]的前缀和.很容易就能想到f[i]=s[i-3]+1,s[i ...

  4. BestCoder Round #50 (div.1) 1001 Distribution money (HDU OJ 5364)

    题目:Click here 题意:bestcoder上面有中文题目 #include <iostream> #include <cstdio> #include <cst ...

  5. BestCoder Round #66 (div.2) 1002

    GTW likes gt  Accepts: 132  Submissions: 772  Time Limit: 2000/1000 MS (Java/Others)  Memory Limit: ...

  6. BestCoder Round #68 (div.2) 1002 tree

    题意:给你一个图,每条边权值0或1,问每个点周围最近的点有多少个? 思路:并查集找权值为0的点构成的连通块. #include<stdio.h> #include<string.h& ...

  7. ACM学习历程—HDU5586 Sum(动态规划)(BestCoder Round #64 (div.2) 1002)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5586 题目大意就是把一段序列里面的数替换成f(x),然后让总和最大. 首先可以计算出初始的总和,以及每 ...

  8. BestCoder Round #73 (div.2)1002/hdoj5631

    题意: 给出一张 nnn 个点 n+1n+1n+1 条边的无向图,你可以选择一些边(至少一条)删除. 分析: 一张n个点图,至少n-1条边才能保证联通 所以可以知道每次可以删去1条边或者两条边 一开始 ...

  9. 素数+map BestCoder Round #54 (div.2) 1002 The Factor

    题目传送门 题意:给出一个数列,问数列的乘积的一个满足条件的最小因子是什么,没有输出-1.条件是不是素数 分析:官方题解:对于每一个数字,它有用的部分其实只有它的所有质因子(包括相等的).求出所有数的 ...

随机推荐

  1. 序列终结者(bzoj 1521)

    Description 网上有许多题,就是给定一个序列,要你支持几种操作:A.B.C.D.一看另一道题,又是一个序列 要支持几种操作:D.C.B.A.尤其是我们这里的某人,出模拟试题,居然还出了一道这 ...

  2. ci框架(codeigniter)Email发送邮件、收件人、附件、Email调试工具

        ci框架(codeigniter)Email发送邮件.收件人.附件.Email调试工具 Email 类         CodeIgniter 拥有强大的 Email 类来提供如下的功能: 多 ...

  3. 牛客网小白月赛1 B,I

    #include <stdio.h> #include <math.h> #include <string.h> #include <stdlib.h> ...

  4. UVA 116_ Unidirectional TSP

    题意: 给定整数矩阵,从第一列的任何一个位置出发,每次可以向右.右上.右下走一个格,将最后一行和第一行看成是邻接的,最终到达最后一列,路径长度为所经过格中的整数之和,求最小路径,答案不唯一,输出字典序 ...

  5. Subsets and Subsets II (回溯,DFS,组合问题)

    Given a set of distinct integers, S, return all possible subsets. Note: Elements in a subset must be ...

  6. AOJ731(不等式)

    题意:有n(n<=100)个石头,每个石头的价值在Ai~Bi(1<=Ai<=Bi<=10000)之间,将这些石头分给两个人,求两个人的最大总价值差的最小值 分析: 与一般的求最 ...

  7. 在springBoot与quartz 整合中 @Transaction 失效

    问题1::springBoot在与quartz 整合时,使用@Transaction 注解时事务失效 解决方案:创建一个类使用@component被spring管理 ,使用@Transaction标识 ...

  8. html上传图片类型

    <html>  <head>  <meta charset="utf-8">  <title>上传图片</title> ...

  9. git锁和钩子以及图形化界面

    1.锁机制 Locking Options 严格锁(strict locking):一个时刻,只有一个人可以占用资源. 乐观锁(optimistic locking):允许多个人同时修改同一文件.乐观 ...

  10. 百度语音识别API初探

    近期想做个东西把大段对话转成文字.用语音输入法太慢,所以想到看有没有现成的API,网上一搜,基本就是百度和讯飞. 这里先看百度的 笔者使用的是Java版本号的 下载地址:http://bos.nj.b ...