HDU 6152 - Friend-Graph
Friend-Graph
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 3072 Accepted Submission(s): 1334
In a team with n members,if there are three or more members are not friends with each other or there are three or more members who are friends with each other. The team meeting the above conditions can be called a bad team.Otherwise,the team is a good team.
A company is going to make an assessment of each team in this company. We have known the team with n members and all the friend relationship among these n individuals. Please judge whether it is a good team.
The first line od each case should contain one integers n, representing the number of people of the team.(n≤3000)
Then there are n-1 rows. The ith row should contain n-i numbers, in which number aij represents the relationship between member i and member j+i. 0 means these two individuals are not friends. 1 means these two individuals are friends.
4
1 1 0
0 0
1
#include <iostream>
#include <cstdio>
using namespace std; bool a[][];
int main()
{ int T;
scanf("%d",&T);
while(T>){
int flag=;
int N;
scanf("%d",&N);
for(int i=;i<N;i++){
for(int j=;j<N;j++){
a[i][j]=;
}
}
for(int b=;b<N;b++)
for(int d=b+;d<N;d++){
scanf("%d",&a[b][d]);
a[d][b]=a[b][d];
}
for(int c=;c<N;c++)
for(int q=c+;q<N;q++)
for(int k=q+;k<N;k++){
int ans=a[c][q]+a[q][k]+a[c][k];
if(ans==||ans==){
flag=;
c=N;
q=N;
break;
}
}
if(flag) printf("Great Team!\n");
else printf("Bad Team!\n"); T--;
}
return ;
}
#include <iostream>
#include <cstdio>
using namespace std; bool a[][];
int main()
{ int T;
scanf("%d",&T);
while(T>){
int flag=;
int N;
scanf("%d",&N);
if(N>){
flag=;
}else{
for(int i=;i<N;i++){
for(int j=;j<N;j++){
a[i][j]=;
}
}
for(int b=;b<N;b++)
for(int d=b+;d<N;d++){
scanf("%d",&a[b][d]);
a[d][b]=a[b][d];
}
for(int c=;c<N;c++)
for(int q=c+;q<N;q++)
for(int k=q+;k<N;k++){
int ans=a[c][q]+a[q][k]+a[c][k];
if(ans==||ans==){
flag=;
c=N;
q=N;
break;
}
}
}
if(flag) printf("Great Team!\n");
else printf("Bad Team!\n"); T--;
}
return ;
}
HDU 6152 - Friend-Graph的更多相关文章
- HDU 6321 Dynamic Graph Matching
HDU 6321 Dynamic Graph Matching (状压DP) Problem C. Dynamic Graph Matching Time Limit: 8000/4000 MS (J ...
- HDU 5876 Sparse Graph 【补图最短路 BFS】(2016 ACM/ICPC Asia Regional Dalian Online)
Sparse Graph Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)To ...
- 2017中国大学生程序设计竞赛 - 网络选拔赛 HDU 6152 Friend-Graph(暴力搜索)
题目传送:http://acm.hdu.edu.cn/showproblem.php?pid=6152 Problem Description It is well known that small ...
- 2017中国大学生程序设计竞赛 - 网络选拔赛 HDU 6152 Friend-Graph 暴暴暴暴力
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6152 题意:判定一个无向图是否有三个点的团或者三个点的独立集. 解法:Ramsey theorem,n ...
- HDU 5876 Sparse Graph BFS 最短路
Sparse Graph Problem Description In graph theory, the complement of a graph G is a graph H on the ...
- hdu 4647 Another Graph Game
题意: 有N个点,M条边. 点有权值, 边有权值. Alice, Bob 分别选点. 如果一条边的两个顶点被同一个人选了, 那么能获得该权值.问 Alice - Bob? 链接:http://acm. ...
- HDU 5876 Sparse Graph
Sparse Graph Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)To ...
- 图论(生成树):HDU 5631Rikka with Graph
Rikka with Graph Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) ...
- hdu 5313 Bipartite Graph(dfs染色 或者 并查集)
Problem Description Soda has a bipartite graph with n vertices and m undirected edges. Now he wants ...
随机推荐
- 如何在新工程中添加两个不同版本的的echarts库
emmmmm.....标题我就觉得起的很变态.闲话不多说,先说出现的背景吧--. 因为业务上的需求,跟一个硬件对接,要做大屏展示大厅客流热力图分布(背景图是客户那边给的).然后这个机子传过来的数据就可 ...
- openlayers4 入门开发系列之风场图篇
前言 openlayers4 官网的 api 文档介绍地址 openlayers4 api,里面详细的介绍 openlayers4 各个类的介绍,还有就是在线例子:openlayers4 官网在线例子 ...
- 002-如何理解Java的平台独立性
本文首发于公众号:javaadu Java有句非常有名的口号--"一次编写,到处运行",依靠的就是JVM提供的平台独立性,本质上来讲,就是通过虚拟机技术,通过限制一些功能,达到屏蔽 ...
- WEB框架-Django框架学习-关联管理器(RelatedManager)
一.class RelatedManager "关联管理器"是在一对多或者多对多的关联上下文中使用的管理器.它存在于下面两种情况: 1.一对多 ForeignKey关系的“另一边” ...
- 如何以编程方式签署应用程序包(C ++)
了解如何使用SignerSignEx2函数对应用包进行签名. 如果要使用Packaging API以编程方式创建Windows应用商店应用包,则还需要在部署之前对应用包进行签名.Packaging A ...
- Ubuntu 安装php+mysql+nginx
0x01 安装PHP https://blog.csdn.net/Msmile_my/article/details/73647809 1.添加php的仓库 sudo apt-get instal ...
- docker快速搭建几个常用的第三方服务
本次和大家分享的内容是使用docker快速搭建工作中常用的第三方的服务,对于有一些互联网背景的公司来说,以下几个服务都是很需要的:redis,rabbit,elasticsearch: 本篇涉及内容深 ...
- 推荐系统(Recommendation system )介绍
前言 随着电子商务的发展,网络购物成为一种趋势,当你打开某个购物网站比如淘宝.京东的时候,会看到很多给你推荐的产品,你是否觉得这些推荐的产品都是你似曾相识或者正好需要的呢.这个就是现在电子商务里面的推 ...
- Linux - 通过SecureCRT的rz、sz和sftp实现文件的上传和下载
目录 1 通过rz/sz命令上传/下载 1.1 安装lrzsz软件 1.2 rz - 上传文件 1.3 sz - 下载文件 2 通过sftp上传/下载文件 2.1 关于SFTP的简介 2.2 SFTP ...
- Nginx学习笔记~目录索引
回到占占推荐博客索引 前几天整理了<Docker的学习笔记索引>,受到了很多朋友的关注,今天把Nginx的文章也整理一下,以后将永久更新,像大叔之前的<EF文章系列>,< ...