HDU 6152 Friend-Graph
来源:互联网 发布:腾讯 知乎 编辑:程序博客网 时间:2024/06/14 03:31
2017中国大学生程序设计竞赛 - 网络选拔赛
Friend-Graph
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1005 Accepted Submission(s): 519
Problem DescriptionIt 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.
InputThe 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 i th 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.
OutputPlease output ”Great Team!” if this team is a good team, otherwise please output “Bad Team!”.
Sample Input141 1 00 01
题目大意: 有 T 组数据; 每组数据输入 N ,接着是N-1行,第 i 行有 N-i 个数(只能为1 或者0 )如果是1,第i个人和第i+j个人是朋友,0则不是朋友。则如果有三个人或以上相互不是朋友或3个人以上相互是朋友,那么输出Bad Team!,否则输出Great Team!
2017中国大学生程序设计竞赛 - 网络选拔赛
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.(
Then there are n-1 rows. The
141 1 00 01
题解:水题,边输入边判断,用flag标记是否出现Bad Team!的情况。
#include<iostream>using namespace std;int main(){ int t; cin>>t; while(t--) { int n; cin>>n; int flag=0; for(int i=0;i<n-1;i++) { int num1=0,num2=0; int m; for(int j=i+1;j<n;j++) { cin>>m; if(m==1)num1++; else num2++; } if(num1>=3||num2>=3)flag=1; } if(flag==1)cout<<"Bad Team!"<<endl; else cout<<"Great Team!"<<endl; } return 0;}
阅读全文
0 0
- HDU 6152 Friend-Graph
- HDU 6152 Friend-Graph
- hdu-6152 Friend-Graph
- HDU 6152 Friend-Graph
- HDU 6152 Friend-Graph
- hdu 6152 Friend-Graph
- HDU-6152Friend-Graph
- HDU 6152 Friend-Graph
- Hdu 6152 Friend-Graph【暴力】
- HDU 6152-Friend-Graph(ccpc)
- HDU 6152 Friend-Graph(定理)
- Hdu 6152 Friend-Graph(Ramsey定理)
- HDU 6152 Friend-Graph (最大团)
- HDU 6152 Friend-Graph(暴力)
- HDU-6152 Friend-Graph (思维+暴力)
- hdu 6152 Friend-Graph(ccpc)
- HDU 6152 Friend-Graph (CCPC2017)
- hdu 6152 Friend-Graph(拉姆齐定理)
- AS实用冷门技术
- Python之禅
- JAVA堆栈图解
- HDOJ1238 C++字符串函数水题
- nginx.conf配置详解
- HDU 6152 Friend-Graph
- 2017年8月23日训练日记
- 第二篇 自制系统内核
- JAVA学习56_用UltraEdit代替“笨重”的IDE,实现轻巧编程!
- 迁移学习和finetune的区别
- 理解js中的原型链,prototype与__proto__的关系
- HDU
- 暑假集训日记--8.23--树状数组
- 正则表达(?i)E是什么意思