题目传送:http://acm.hdu.edu.cn/showproblem.php?pid=6152

Problem Description
It is well known that small groups are not conducive of the development of a team. Therefore, there shouldn’t be any small groups in a good team.
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 of the input gives the number of test cases T; T test cases follow.(T<=15)
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
Please output ”Great Team!” if this team is a good team, otherwise please output “Bad Team!”.
 
Sample Input
1
4
1 1 0
0 0
1
 
Sample Output
Great Team!

题解:暴搜可以过,因为时间给的多。

然后保存的数组类型不是int是bool,要不然会MLE。

其实也可以发现当点数大于等于6的时候,都是bad team了。

 #include <iostream>
#include<bits/stdc++.h>
using namespace std; bool a[][];//评论提醒只需a[7][7]即可
int t,n; bool work()
{
for(int i=;i<=n;i++)
{
for(int j=i+;j<=n;j++)
if(a[i][j]==)
{
for(int k=j+;k<=n;k++)
if (a[j][k]== && a[k][i]==) return ;
} else
{
for(int k=j+;k<=n;k++)
if(a[j][k]== && a[k][i]==) return ;
}
}
return ;
} int main()
{
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
for(int i=;i<=n;i++)
{
for(int j=;j<=n-i;j++)
{
int x;
scanf("%d",&x);
a[i][i+j]=x;
a[i+j][i]=x;
}
}
if (n>) {printf("Bad Team!\n"); continue;}
if(work()) printf("Great Team!\n");
else printf("Bad Team!\n");
}
return ;
}

2017中国大学生程序设计竞赛 - 网络选拔赛 HDU 6152 Friend-Graph(暴力搜索)的更多相关文章

  1. 2017中国大学生程序设计竞赛 - 网络选拔赛 HDU 6152 Friend-Graph 暴暴暴暴力

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6152 题意:判定一个无向图是否有三个点的团或者三个点的独立集. 解法:Ramsey theorem,n ...

  2. 2017中国大学生程序设计竞赛 - 网络选拔赛 HDU 6155 Subsequence Count 矩阵快速幂

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6155 题意: 题解来自:http://www.cnblogs.com/iRedBean/p/73982 ...

  3. 2017中国大学生程序设计竞赛 - 网络选拔赛 HDU 6150 Vertex Cover 二分图,构造

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6150 题意:"最小点覆盖集"是个NP完全问题 有一个近似算法是说—每次选取度数最大 ...

  4. 2017中国大学生程序设计竞赛 - 网络选拔赛 HDU 6154 CaoHaha's staff 思维

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6154 题意:在笛卡尔坐标系下,画一个面积至少为  n 的简单多边形,每次只能画一条边或者一个格子的对角 ...

  5. 2017中国大学生程序设计竞赛 - 网络选拔赛 HDU 6153 A Secret KMP,思维

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6153 题意:给了串s和t,要求每个t的后缀在在s中的出现次数,然后每个次数乘上对应长度求和. 解法:关 ...

  6. 2017中国大学生程序设计竞赛 - 网络选拔赛 HDU 6156 数位DP

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6156 题意:如题. 解法:数位DP,暴力枚举进制之后,就转化成了求L,R区间的回文数的个数,这个直接做 ...

  7. 2017中国大学生程序设计竞赛 - 网络选拔赛 HDU 6154 CaoHaha's staff(几何找规律)

    Problem Description "You shall not pass!"After shouted out that,the Force Staff appered in ...

  8. 【2017中国大学生程序设计竞赛 - 网络选拔赛 && hdu 6154】CaoHaha's staff

    [链接]点击打开链接 [题意] 给你一个面积,让你求围成这个面积最少需要几条边,其中边的连线只能是在坐标轴上边长为1的的线或者是两个边长为1 的线的对角线. [题解] 找规律题 考虑s[i]表示i条边 ...

  9. 【2017中国大学生程序设计竞赛 - 网络选拔赛 hdu 6150】Vertex Cover

    [链接]点击打开链接 [题意] 有人写了一个最小点覆盖的贪心算法,然后,让你去hack它. 并且,要求这个算法得到的错误答案,是正确答案的三倍. 让你任意输出hack数据,点数<=500 [题解 ...

随机推荐

  1. 解决validaform先验证后 ajax提交

    $(".myfroms").Validform({//form class btnSubmit:".submitLayer", 绑定提交按钮 tiptype:4 ...

  2. PAT 1008 Elevator

    1008 Elevator (20 分)   The highest building in our city has only one elevator. A request list is mad ...

  3. Redis开发规范

    1.冷热数据分离,不要将所有数据全部都放到Redis中 虽然Redis支持持久化,但是Redis的数据存储全部都是在内存中的,成本昂贵.建议根据业务只将高频热数据存储到Redis中[QPS大于5000 ...

  4. 2015-09-22 css2

    6.块元素和行内元素 1. 块元素特点:默认显示在父标签的左上角 块级元素默认占满一行(占满整个文档流) 常见的块元素:p,h1--h6,ul li, ol li,div,hr,table. 2.行内 ...

  5. office install problems

    regedit 0000 "00005"或"00002"开头的项 remove all regedit options

  6. memory prefix il ir im in out 3 i

    1● il   2● ir 不 非 无 :使 ~ 成为:   3● im 4● in 不 非 无 :向内,进入  

  7. Oracle中如何停止正在执行SQL语句

    oracle的用P/SQL客户端中,如何停止正在执行的SQL语句? 我们使用oracle语句查询某个表时,如果查询的表数据太多,如何停止正在执行操作 如查询的表数据超过上万条时,如何停止查询操作

  8. vs2015 出现Lc.exe 已退出,代码为-1的问题,如何解决

    今天在代码运行时,出现lc.exe已退出,代码为-1 的问题

  9. C++ 解析一

    C++ 类和对象C++ 在 C 语言的基础上增加了面向对象编程,C++ 支持面向对象程序设计.类是 C++ 的核心特性,通常被称为用户定义的类型.类用于指定对象的形式,它包含了数据表示法和用于处理数据 ...

  10. java 实现简单循环队列

    package www.queue; import java.util.Arrays; /** * 循环队列: * 循环队列的出现是为了解决顺序队列出队列后,首指针向后移动后前面的存储过程浪费不能使用 ...