HDU6152
Friend-Graph
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 28 Accepted Submission(s): 15
Problem Description
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.
Input
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.
Output
Sample Input
4
1 1 0
0 0
1
Sample Output
Source
//2017-08-19
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm> using namespace std; const int N = ;
bool G[N][N];
int n; void work(){
for(int i = ; i <= n; i++){
for(int j = i+; j <= n; j++){
if(G[i][j] == ){
for(int k = j+; k <= n; k++){
if(G[i][k] == && G[j][k] == ){
printf("Bad Team!\n");return;
}
}
}
if(G[i][j] == ){
for(int k = j+; k <= n; k++){
if(G[i][k] == && G[j][k] == ){
printf("Bad Team!\n");return;
}
}
}
}
}
printf("Great Team!\n");
} int main()
{
int T, a;
scanf("%d", &T);
while(T--){
scanf("%d", &n);
for(int i = ; i <= n-; i++){
for(int j = i+; j <= n; j++){
scanf("%d", &a);
G[j][i] = G[i][j] = a;
}
}
work();
} return ;
}
HDU6152的更多相关文章
- 图论&数学:拉姆齐(Ramsey)定理
拉姆齐(Ramsey)定理是要解决以下的问题:要找这样一个最小的数n,使得n个人中必定有k个人相识或l个人互不相识 我们所知道的结论是这样的 6 个人中至少存在3人相互认识或者相互不认识. 该定理等价 ...
随机推荐
- Xshell 配色方案
[wsp] text=cOc0c0 cyan(bold)=50ebfc text(bold)=9999e8 magenta=7b5175 green=008000 green(bold)=1cc470 ...
- spring mvc 使用kaptcha配置生成验证码实例
SpringMVC整合kaptcha(验证码功能) 一.依赖 <dependency> <groupId>com.github.penggle</groupId> ...
- (转)kafka实战教学
转载自:https://www.cnblogs.com/hei12138/p/7805475.html Apache kafka 工作原理介绍-----https://www.ibm.com/deve ...
- Android从零开始
Android开发环境的安装 1 IDE Android可以使用开发的IDE有Eclipse 或者 Android Studio.Android Studio还处于v 0.1.x版本,是early a ...
- godaddy 问题
1. 域名被锁,打电话咨询后.说发送被锁的域名到: change@secureserver.net 去解锁.
- css outline实践研究
outline具有和border很相似的属性,但多少又有些区别,就是因为这些区别才让它闪闪发光,先目睹一下. <style> div{ width:100px; height:100px; ...
- springboot 入门
使用maven构建project项目, 配置aliyun仓库, 不赘述 springboot 版本需要: jdk1.7+, maven3.2+ , gradle2.9+ 配置文件 引入父包, 放在&l ...
- MVC源码分析 - Action/Result 过滤器(续)
上一篇 看到了Action/Result过滤器的执行顺序: OnActionExecuting -> Action -> OnActionExecuted -> OnResultEx ...
- 查看 postgresql 数据库编码,以及修改数据库编码
查看数据表编码: \encoding 修改数据库编码: update pg_database set encoding = pg_char_to_encoding('UTF8') where datn ...
- Visual Studio自带的的Developer Command Prompt对话框
简单了解Visual Studio的Developer Command Prompt VS2008的命令为:Visual Studio 2008 Command Prompt 目录是: 其详细信息如下 ...