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 ...
随机推荐
- 在sql中使用函数,遇到net.sf.jsqlparser.parser.ParseException异常
异常详情如下 Caused by: net.sf.jsqlparser.parser.ParseException: Encountered " "->" &quo ...
- 测开之路一百一十:bootstrap图片
bootstrap图片 引入bootstrap 原版的图片 bootstrap处理后的: 圆角.圆形.缩略图 自适应窗口
- Jmeter+ SeureCRT + Pinpoint
1.环境配置 [相关操作] 下载jdk http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.h ...
- 【python+selenium自动化】图像识别技术在UI自动化测试中的实际运用
引言: 目前在图像识别方面的自动化测试框架有很多,其中比较有名的是airtest,主要做手机端的游戏自动化测试(http://airtest.netease.com/) 因为没有实际把airtest运 ...
- A heavy dew refreshed the earth at night
brightness.n.明亮 endless.adj.无止境的 degradation.n.堕落 superiority.n.优越性 valuable.adj.有价值的 flake.n.小薄片 cu ...
- Generative Model vs Discriminative Model
In this post, we are going to compare the two types of machine learning models-generative model and ...
- Vue入门---安装及常用指令介绍
1.安装 BootCDN----官网https://www.bootcdn.cn/ <script src="https://cdn.bootcss.com/vue/2.6.10/vu ...
- 20191105 《Spring5高级编程》笔记-第6章
第6章 Spring JDBC支持 Spring官方: 位于Spring Framework Project下. 文档: https://docs.spring.io/spring-framework ...
- python-IDE的使用(小白先看)
一.定义 IDE:集成开发环境(Integrated Development Environment) 二.常见的IDE工具: 1.VIM,经典的Linux下的文本编辑器 2.Emacs,LInux的 ...
- Spring源码解析-核心类之XmlBeanFactory 、DefaultListableBeanFactory
DefaultListableBeanFactory XmlBeanFactory 继承自 DefaultListableBeanFactory , 而 DefaultListableBeanFact ...