简单几何(水)BestCoder Round #50 (div.2) 1002 Run
/*
好吧,我不是地球人,这题只要判断正方形就行了,正三角形和正五边形和正六边形都不可能(点是整数)。
但是,如果不是整数,那么该怎么做呢?是否就此开启计算几何专题了呢
*/
/************************************************
* 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的更多相关文章
- BestCoder Round #50 (div.1) 1002 Run (HDU OJ 5365) 暴力枚举+正多边形判定
题目:Click here 题意:给你n个点,有多少个正多边形(3,4,5,6). 分析:整点是不能构成正五边形和正三边形和正六边形的,所以只需暴力枚举四个点判断是否是正四边形即可. #include ...
- 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 ...
- 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 ...
- BestCoder Round #50 (div.1) 1001 Distribution money (HDU OJ 5364)
题目:Click here 题意:bestcoder上面有中文题目 #include <iostream> #include <cstdio> #include <cst ...
- BestCoder Round #66 (div.2) 1002
GTW likes gt Accepts: 132 Submissions: 772 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: ...
- BestCoder Round #68 (div.2) 1002 tree
题意:给你一个图,每条边权值0或1,问每个点周围最近的点有多少个? 思路:并查集找权值为0的点构成的连通块. #include<stdio.h> #include<string.h& ...
- ACM学习历程—HDU5586 Sum(动态规划)(BestCoder Round #64 (div.2) 1002)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5586 题目大意就是把一段序列里面的数替换成f(x),然后让总和最大. 首先可以计算出初始的总和,以及每 ...
- BestCoder Round #73 (div.2)1002/hdoj5631
题意: 给出一张 nnn 个点 n+1n+1n+1 条边的无向图,你可以选择一些边(至少一条)删除. 分析: 一张n个点图,至少n-1条边才能保证联通 所以可以知道每次可以删去1条边或者两条边 一开始 ...
- 素数+map BestCoder Round #54 (div.2) 1002 The Factor
题目传送门 题意:给出一个数列,问数列的乘积的一个满足条件的最小因子是什么,没有输出-1.条件是不是素数 分析:官方题解:对于每一个数字,它有用的部分其实只有它的所有质因子(包括相等的).求出所有数的 ...
随机推荐
- Mysql Replace语句的使用
Mysql Replace语句的语法: REPLACE [LOW_PRIORITY | DELAYED] [INTO] tbl_name [(col_name,...)] VALUES ({expr ...
- 【ZJOI2017 Round1练习】D8T1 mushroom(点分治)
题意: 思路: num[a[u]]表示存在a[u]这个颜色且终点在u子树中的链长总和 ans[i]表示以当前的u为根,前面的子树对i的贡献之和 ..]of longint; size,f,ans,su ...
- Codeforces698C. LRU
n<=20种东西,有个大小k<=n的箱子,每次会以固定的概率从所有东西里选一种,若箱子里有空位且这种东西没出现过就丢进去,若箱子满了且这种东西没出现过就把最早访问过的一个丢掉,(只要在每次 ...
- struct init
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h& ...
- view属性大全
- Ubuntu 16.04安装Intel显卡驱动(解决Intel HD Graphics 630显卡驱动问题)
一般Ubuntu都默认包含了Intel显卡的驱动,如果没有,那么先确定是不是显卡太高,比如I7第7代的CPU核显在Ubuntu 16.04中是没有的,导致画面会很卡,原因是Linux 4.4内核不包含 ...
- canvas 插件
http://www.jq22.com/yanshi2217 参考这个站 发现一些比较有用的canvas插件: 线形图插件:jquery.sparkline 2.1.1 excanvas 环形图,饼状 ...
- Django学习系列之Python+Xadmin
项目树 引入xadmin pycharm在项目中创建存放xadmin的目录 右键项目名称-->pythonpackage-->输入名称:extra_app 拷贝xadmin代码到extra ...
- C++中使用Json的方法
使用 C++ 处理 JSON 数据交换格式 一.摘要 JSON 的全称为:JavaScript Object Notation,顾名思义,JSON 是用于标记 Javascript 对象的,JSON官 ...
- nginx-Proxy Cache缓存
1.创建目录 mkdir /export/Data/nginx_proxy_cache mkdir /export/Data/nginx_proxy_temp 2.修改http,打开缓存 文件 ...