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人相互认识或者相互不认识. 该定理等价 ...
随机推荐
- Django(视图 CBV、FBV)
day67 参考:http://www.cnblogs.com/liwenzhou/articles/8305104.html CBV和FBV 我们之前写过的都是基于函数的view,就叫FBV.还可以 ...
- C#6.0语言规范(六) 转换
转换能够被视为是一个特定类型的表达式.转换可能会导致给定类型的表达式被视为具有不同的类型,或者它可能导致没有类型的表达式获取类型.转换可以是隐式或显式的,这决定了是否需要显式转换.例如,从类型int到 ...
- Linux巩固记录(8) Hbase shell 基本使用
继续前几篇内容,讲解hbase基本使用 1.进入hbase shell: hbase有很多种操作方式,比如shell,java客户端,webUI等,可以直接输入hbase进行提示 [root@mast ...
- TypeScript设计模式之装饰、代理
看看用TypeScript怎样实现常见的设计模式,顺便复习一下. 学模式最重要的不是记UML,而是知道什么模式可以解决什么样的问题,在做项目时碰到问题可以想到用哪个模式可以解决,UML忘了可以查,思想 ...
- odoo开发笔记-自定义发送邮件模板
1. 首先激活开发者模式 2. 点击设置 - Email - 模板 - “选择你需要修改的模板” 我们以销售模块-报价单 邮件模板为例 来说明. quote order 原先默认模板,发出的邮件显示效 ...
- 前端代码质量保障之代码review
经验丰富的程序员和一般程序员之间的最大区别,不仅体现在解决问题的能力上, 还体现在日常代码的风格上.掌握一门技术可能需要几月,甚至几周就够了. 好的习惯风格养成却需数年. 团队成员之间需要合作,代码需 ...
- CDN基本工作过程
看了一些介绍CDN的文章,感觉这篇是讲的最清楚的. 使用CDN会极大地简化网站的系统维护工作量,网站维护人员只需将网站内容注入CDN的系统,通过CDN部署在各个物理位置的服务器进行全网分发,就可以实现 ...
- PLSQL Developer概念学习系列之登录连接Oracle时出现(没有登录) -PL / SQL Developer:ORA - 12541: TNS :无建听程序的错误解决办法(图文详解)
不多说,直接上干货! 前期博客 PLSQL Developer概念学习系列之如何正确登录连接上Oracle(图文详解) 如用scott.scott_password进行登录,orcl是全局数据库 ...
- PHP-引入文件(include)后,页面错位,不居中解决办法
1.把include文件放在head里,不要放在html或doctype上面,这样可以解决居中的问题,空白行的话可以用<div style="display:none"> ...
- JavaScript -- Location
-----043-Location.html----- <!DOCTYPE html> <html> <head> <meta http-equiv=&quo ...