编程介的小学生 2019-08-20 19:57 采纳率: 20.5%
浏览 84

Get-Together at Stockholm程序编程怎么做的

Problem Description
Peter has recently decided to hold a party at Stockholm, where the ACM/ICPC 2009 World Final will be held. Unfortunately, despite Peter’s affluence, he is not able to invite all of his friends due to the astronomical price of the air ticket to Stockholm.
He has devised the following rule to determine which subset of his friends will be invited:
a) Any invited person must have at least A acquaintances at the party. This is to ensure everyone at the party will not feel alien.
b) Any invited person must be unfamiliar with at least B people. Otherwise some people may not have the chance to communicate with a stranger.
Given the relationships between Peter’s friends, you are to figure out whom Peter should invite to the party so as to maximize its size.

Input
There are multiple test cases in the input file.
Each test case starts with four integers, N, M, A, and B ( 1 ≤ N ≤ 100 , 0 ≤ M ≤ N*(n-1)/2 , 0 ≤ A , B ≤ N - 1). Each of the following M lines contains
two integers, X and Y, ( 0 ≤ X,Y ≤ N-1 , X≠Y), indicating that friend X and friend Y are acquaintances.
Two successive test cases are separated by a blank line. A case with N = 0, M = 0,A = 0 and B = 0 indicates the end of the input file, and should not be processed by your program.

Output
For each test case, please print a single integer, the maximum number of friends
Peter will be able to invite.

Sample Input
3 2 1 1
0 1
1 2
4 4 2 1
0 1
1 2
2 3
0 3
0 0 0 0

Sample Output
Case #1: 0
Case #2: 4

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?