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 ...
随机推荐
- Windows Server 2016 安装虚拟机版黑群晖
硬件配置 Dell R730 CPU: Intel(R) Xeon(R) CPU E5-2603 v4 @1.70GHz(6 cores) Ram: 16Gb HDD: 系统-600GB SAS X2 ...
- 自己手动搭建jenkins教程
下载列表; http://updates.jenkins-ci.org/download/war/ 本次下载: http://updates.jenkins-ci.org/download/war/ ...
- grep 及正则表达式
grpe 及正则表达式 文本查找的需要:grep,egrep,fgrepgrep: 根据模式,搜索文本,并将符合模式的文本行显示出来.Pattern : 文本字符以及正则表达式的元字符组合而成的匹配条 ...
- missing requires of libmysqlclient.so.18()(64bit)
错误提示安装依赖的库文件没有找到: libmysqlclient.so.18()(64bit) 解决方法是这样的: 安装mysql-community-libs-compat-5.7.18-1 ...
- SpringBoot2.0 项目中使用事务
参考博客: SpringBoot开启事务常见坑点 另外注意手动回滚事务需要 (1)在业务层方法上添加注解 @Transactional (2)在需要回滚的地方添加代码: TransactionAspe ...
- 【Dubbo篇】--Dubbo框架的使用
一.前述 Dubbo是一种提供高性能,透明化的RPC框架.是阿里开源的一个框架. 官网地址:http://dubbo.io/ 二.架构 组件解释: Provider: 提供者.发布服务的项目.Regi ...
- C#反射调用方法实例
下面是两个反射的实例 案例1: 动态调用类中的方法.传入参数,并获得返回值. xxxx:类名 Event:类中的方法 pra1,pra2,pra3:方法对应的入参 DoRet:方法返回的执行结果 Ty ...
- 8-Flink中的窗口
戳更多文章: 1-Flink入门 2-本地环境搭建&构建第一个Flink应用 3-DataSet API 4-DataSteam API 5-集群部署 6-分布式缓存 7-重启策略 8-Fli ...
- 生产线平衡问题的+Leapms线性规划方法
知识点 第一类生产线平衡问题,第二类生产线平衡问题 整数线性规划模型,+Leapms模型,直接求解,CPLEX求解 装配生产线平衡问题 (The Assembly Line Balancing Pro ...
- RDIFramework.NET代码生成器全新V3.5版本发布-重大升级
发布说明 RDIFramework.NET代码生成器V3.5版本全新震撼推出,相比上次版本,本次发布新增与修改的内容如下: 1.全新增加了WinForm界面代码的生成,可直接生成常用的主界面(集新增. ...