zoukankan      html  css  js  c++  java
  • Friend-Graph

    Friend-Graph

    Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
    Total Submission(s): 3254    Accepted Submission(s): 523


    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.(n3000)

    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!
    这道题当时题意是猜的自己真的没看懂,英语太烦了.
     1 #include <bits/stdc++.h>
     2 using namespace std;
     3 int num[3010];
     4 int main(){
     5     int T;
     6     scanf("%d",&T);
     7     while(T--){
     8         int n;
     9         scanf("%d",&n);
    10         bool prime=true;
    11         if(n>5)
    12             prime=false;
    13         int m;
    14         memset(num,0,sizeof(num));
    15         for(int i=1;i<n;i++){
    16                 for(int j=1;j<=n-i;j++){
    17                         scanf("%d",&m);
    18                         if(m==1){
    19                                 num[i]++;
    20                                 num[i+j]++;
    21                         }
    22                 }
    23         }
    24         if(!prime)
    25             printf("Bad Team!
    ");
    26         else{
    27             for(int i=1;i<=n;i++){
    28                     if(num[i]>=3||(n-1-num[i])>=3)
    29                         prime=false;
    30             }
    31             if(prime)
    32                 printf("Great Team!
    ");
    33             else
    34                 printf("Bad Team!
    ");
    35         }
    36     }
    37     return 0;
    38 }
  • 相关阅读:
    oracle中 char,varchar,varchar2的区别
    .net + oracle + win2003部署遇到的问题集合
    Oracle下如何获得随机数,如何保留小数,如何取整数
    Oracle 函数大全(字符串函数,数学函数,日期函数,逻辑运算函数,其他函数)
    Service和广播联合更新UI的例子
    [python] 类常用的内置方法
    android textview 换行 "\r\n"
    java操作excel
    项目指导原则
    SVN与bugzilla整合
  • 原文地址:https://www.cnblogs.com/zllwxm123/p/7397349.html
Copyright © 2011-2022 走看看