2017中国大学生程序设计竞赛
来源:互联网 发布:msp驱动mac 编辑:程序博客网 时间:2024/06/15 00:57
题目:
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 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.
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. Thei 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.
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
Output
Please output ”Great Team!” if this team is a good team, otherwise please output “Bad Team!”.
Sample Input
141 1 00 01
Sample Output
Great Team!
思路:水题,边输入边判断,用flag标记是否出现Bad Team!的情况~
code:
#include<bits/stdc++.h>using namespace std;int main(){ int t,n,i,j,k,a,b,flag; scanf("%d",&t); while(t--){ scanf("%d",&n); flag=0; for(i=1;i<n;i++){ a=b=0; for(j=i+1;j<=n;j++){ scanf("%d",&k); if(k) a++; else b++; } if(a>=3||b>=3) flag=1; } if(flag) puts("Bad Team!"); else puts("Great Team!"); } return 0;}
阅读全文
0 0
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 【HDU6150 2017中国大学生程序设计竞赛
- 【HDU6152 2017中国大学生程序设计竞赛
- 【HDU6153 2017中国大学生程序设计竞赛
- Linux下搭建路由器
- 20170820_C++库函数中unique()和unique_copy()和sort()函数的用法
- 青风nrf51822开发板学习记录
- 硬盘内部硬件结构和工作原理详解
- socket 服务器关闭以后之地址复用
- 2017中国大学生程序设计竞赛
- 企业职位英文缩写
- MongoDB执行计划
- C6678->SRIO和FPGA的通信
- HDU 5981 && 2016ICPC大连 K: Guess the number(推理)
- java collection
- 自定义View系列:广告倒计时View
- 在其他数都出现k次的数组中找到只出现一次的数
- 各类算法笔试题汇总