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 ...
随机推荐
- 让人失望透顶的 CSDN 博客改版
前言 在 CSDN 写博已经 2 年有余,相比一些大佬,时间不算太长.但工作再忙,我也会保持每月产出,从未间断.每天上线回复评论,勘误内容,参加活动,看看阅读量已经成为一种习惯,可以说是 CSDN 博 ...
- VMware 接入 Openstack — 使用 Openstack 创建 vCenter 虚拟机
目录 目录 软件环境 前言 Openstack 接口驱动 使用 KVM 在 Compute Node 上创建虚拟机的流程 使用 VCDirver 在 vCenter 上创建虚拟机的流程 配置 vCen ...
- 用python进行月份加减的函数
import math def add_month(datamonth, num): """ 月份加减函数,返回字符串类型 :param datamonth: 时间(20 ...
- C# 模拟登陆
原理 我们知道,一般需要登录的网站,服务器和客户端都会有一段时间的会话保持,而这个会话保持是在登录时候建立的, 服务端和客户端都会持有这个KEY,在后续访问时,都需要核对这两个KEY是否一致. 而客户 ...
- python实现建立udp通信
实现代码如下: #udp协议通信import socket,timeclass UdpConnect: def get_udp(self,ip,port,message): #建立udp连接 myso ...
- SSM003/构建Maven单模块项目(二)
一.Controller基础代码(mooc) 1.UserController.java /** *springmvc1-2:返回jsp页面 * 请求URL: /user/getUserById?us ...
- web 前端2 CSS
CSS CSS是Cascading Style Sheets的简称,中文称为层叠样式表,用来控制网页数据的表现,可以使网页的表现与数据内容分离. 一 css的四种引入方式 1.行内式 ...
- JS 数组的常用方法归纳之不改变原数组和其他
不改变原数组的方法 concat() 连接两个或多个数组,不改变现有数组,返回新数组,添加的是数组中的元素 join(",") 把数组中的所有元素放入一个字符串,通过‘,’分隔符进 ...
- Mybatis-学习笔记(1)SqlSessionFactory、SqlSession、Mybatis配置文件configuration的属性标签
1.mybatis引入项目,只需要引入mybatis-x.x.x.jar包即可. (当然数据库驱动的引入必不可少) 2.SqlSessionFactory 由SqlSessionFactoryBuil ...
- <每日一题> Day4:CodeForces-1042A.Benches(二分 + 排序)
题目链接 参考代码: /* 排序 + 每次取小 #include <iostream> #include <algorithm> using namespace std; co ...