Codeforces 850A - Five Dimensional Points(暴力)
原题链接:http://codeforces.com/problemset/problem/850/A
题意:有n个五维空间内的点,如果其中三个点A,B,C,向量AB,AC的夹角不大于90°,则点A是“bad”的否则是“good”。题目让我们输出good的点。
思路:从2,3维空间超过5,7个点时不存在“good”的点,可以简单推知五维空间内,超过11个点时不存在“good”的点,那么点数小于11时暴力,大于11时输出0.
其实由于数据量小,直接暴力也是可行的。
AC代码:
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
using namespace std;
const int MAXN=;
struct Node{
int a,b,c,d,e;
}node[MAXN];
bool pend(Node A, Node B, Node C)
{
Node AB,AC;
AB.a=B.a-A.a;
AB.b=B.b-A.b;
AB.c=B.c-A.c;
AB.d=B.d-A.d;
AB.e=B.e-A.e;
AC.a=C.a-A.a;
AC.b=C.b-A.b;
AC.c=C.c-A.c;
AC.d=C.d-A.d;
AC.e=C.e-A.e;
if(AB.a*AC.a+AB.b*AC.b+AB.c*AC.c+AB.d*AC.d+AB.e*AC.e<=) return ;
return ;
}
int main()
{
int n;
while(cin>>n)
{ vector<int> res;
for(int i=;i<n;i++){
scanf("%d %d %d %d %d", &node[i].a, &node[i].b, &node[i].c, &node[i].d ,&node[i].e);
}
if(n==){
printf("%d\n%d\n", , );
continue;
}
else if(n==){
printf("%d\n%d\n%d\n", , , );
continue;
}
else if(n>){
printf("%d\n", );
continue;
}
bool flag;
for(int i=;i<n;i++){
flag=;
for(int j=;j<n;j++){
for(int k=j+;k<n;k++){
if(pend(node[i], node[j], node[k])){
flag=;
j=n+;
break;
}
}
}
if(!flag) res.push_back(i);
}
int l=res.size();
printf("%d\n", l);
for(int i=;i<l;i++)
printf("%d\n", res[i]+);
}
return ;
}
Codeforces 850A - Five Dimensional Points(暴力)的更多相关文章
- codeforces 851C Five Dimensional Points(鸽巢原理)
http://codeforces.com/contest/851/problem/C 题意 - 给出 n 个五维空间的点 - 一个点a为 bad 的定义为 存在两点 b, c, 使的<ab, ...
- Five Dimensional Points CodeForces - 851C (计算几何+暴力)
C. Five Dimensional Points time limit per test 2 seconds memory limit per test 256 megabytes input ...
- 【推导】【暴力】Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) C. Five Dimensional Points
题意:给你五维空间内n个点,问你有多少个点不是坏点. 坏点定义:如果对于某个点A,存在点B,C,使得角BAC为锐角,那么A是坏点. 结论:如果n维空间内已经存在2*n+1个点,那么再往里面添加任意多个 ...
- 【Codeforces Round #432 (Div. 1) A】 Five Dimensional Points
[链接]点击打开链接 [题意] 给你n个5维的点. 然后让你以其中的某一个点作为起点a. 另选两个点b,c. 组成向量a->b,a->c 如果所有的a->b和a->c的夹角都是 ...
- Codeforces Gym 100015H Hidden Code 暴力
Hidden Code 题目连接: http://codeforces.com/gym/100015/attachments Description It's time to put your hac ...
- Codeforces gym 100685 A. Ariel 暴力
A. ArielTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100685/problem/A Desc ...
- Codeforces Gym 100637G G. #TheDress 暴力
G. #TheDress Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100637/problem/G ...
- [ An Ac a Day ^_^ ] CodeForces 691F Couple Cover 花式暴力
Couple Cover Time Limit: 3000MS Memory Limit: 524288KB 64bit IO Format: %I64d & %I64u Descri ...
- Codeforces 626D Jerry's Protest(暴力枚举+概率)
D. Jerry's Protest time limit per test:2 seconds memory limit per test:256 megabytes input:standard ...
随机推荐
- JsonDatetime
ToDatetime public DateTime JsonDateTimeConvert(string time) { //try //{ if (String.IsNullOrEmpty(tim ...
- Golang new() vs make()
对于Golang的new() 和 make()的用法有些混乱,感觉这篇资料讲解较好,翻译一下,方便学习! 原文地址:http://www.godesignpatterns.com/2014/04/ne ...
- JAVA在页面查看或下载服务器上的日志
1.配置 FileUtils类所需jar包的maven地址 <dependency> <groupId>commons-io</groupId> <artif ...
- myeclipse 2015 myeclipse2010破解共存
1.高版本选择bling版本,低版本选择profession版本2.用高版本的公钥替换低版本的公钥3.先破解低版本的后破解高版本的4.最后用高版本的替换低版本的文件
- 【EWM系列】SAP EWM WCU和Non-SAP系统接口
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[MM系列]SAP EWM WCU和Non-SA ...
- 【USACO18JAN】MooTube
原文链接:https://blog.csdn.net/Patrickpwq/article/details/86656456 给定一棵n个点的树(n=1e5),有边权, 两点间距离定义为两点路径上的 ...
- UVa 11582 Colossal Fibonacci Numbers! 紫书
思路是按紫书上说的来. 参考了:https://blog.csdn.net/qwsin/article/details/51834161 的代码: #include <cstdio> # ...
- VMware下Linux构建仅主机模式的局域网网络配置方案
最近使用Linux,进行网络配置,以前都是桥接直连,然后直接组网.由于一些原因现在虚拟机做内网使用,不用上网,只能使用仅主机模式.在仅主机模式下进行虚拟机组网. 仅主机模式下各个虚拟机只能和主机通信, ...
- Node.js实战13:fs模块奥义!开发一个数据库。
本文,将使用fs开发一种简单的文件型数据库. 数据库中,记录将采用JSON模式,内容型如: {"key":"a","value":" ...
- 触摸板PCB制作-TM12
1.布局: 使 PSoC 与Sensor之间的距离保持最小化是一个不错的做法. 通常将 PSoC 与其他组件一起贴装到底层,而将 CapSense Sensor置于顶层上. Sensor和栅格地层位 ...