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 }
  • 相关阅读:
    htmlUnil-2.33 jar包
    HtmlUnil 不兼容问题
    Java 网页抓取 工具类
    浏览器不兼容
    Chrome常用调试技巧1
    关于社交网络的思考
    google浏览器历史旧版
    EJB是什么Java使用EJB容器的详细概述
    何必言精通——十年杂感(转载)
    搜索优化—如何在Google搜索引擎上排名靠前Google左侧排名
  • 原文地址:https://www.cnblogs.com/zllwxm123/p/7397349.html
Copyright © 2011-2022 走看看