22183_Houses

2022-5-16 18:21| 发布者: Hocassian| 查看: 20| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506181262100-Problem List-采集的数据-后羿采集器.html

Pro.ID

22183

Title

Houses

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22183

AC

9

Submit

13

Ratio

69.23%

时间&空间限制

  • Time Limit: 0/0 MS (Java/Others)     Memory Limit: 0/0 K (Java/Others)
  • 描述

    There are several houses in a village. Houses are connected by roads, since building a road will cost much money, any two houses are connected by at most one road, and every road is guaranteed to connect two different houses.

    In the village, the smartest people always live in the most convenient house, and the most convenient house is a house connecting to the maximum number of houses. Now it is your task to find out the number of houses connecting to the most convenient house.

    输入

    There're multiple cases. The first line of each case contains two integers n and m ( 1 ≤ n ≤ 20,  0 ≤ m ≤ 20 ), indicating the number of houses and the number of roads, houses are numbered from 1 to n. Then for each of the following m lines, there are two different integers a and b ( 1 ≤ a, bn ), indicating that there is a road connecting house a and house b. Input is terminated by two 0's.

    输出

    Description

    There are several houses in a village. Houses are connected by roads, since building a road will cost much money, any two houses are connected by at most one road, and every road is guaranteed to connect two different houses.

    In the village, the smartest people always live in the most convenient house, and the most convenient house is a house connecting to the maximum number of houses. Now it is your task to find out the number of houses connecting to the most convenient house.

    Input

    There're multiple cases. The first line of each case contains two integers n and m ( 1 ≤ n ≤ 20,  0 ≤ m ≤ 20 ), indicating the number of houses and the number of roads, houses are numbered from 1 to n. Then for each of the following m lines, there are two different integers a and b ( 1 ≤ a, bn ), indicating that there is a road connecting house a and house b. Input is terminated by two 0's.

    Output

    For each case output the result in one line.

    Sample Input

    1 0
    2 0
    2 1
    1 2
    3 2
    1 2
    2 3
    5 3
    1 2
    3 4
    4 5
    0 0

    Sample Output

    0
    0
    1
    2
    2

    Hint

    请忽略本题。

    Source

    样例输入

    1 0
    2 0
    2 1
    1 2
    3 2
    1 2
    2 3
    5 3
    1 2
    3 4
    4 5
    0 0

    样例输出

    0
    0
    1
    2
    2

    提示

    请忽略本题。


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部