【百度之星】【思维】Totori's Switching Game

思维题,最后只要判断每个点的度数>=k即可。

#pragma comment(linker, "/STACK:1024000000,1024000000")
#pragma GCC optimize(2)
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<queue>
#include<set>
#include<cmath>
#include<string>
#include<map>
#include<vector>
#include<ctime>
#include<stack>
using namespace std;
#define mm(a,b) memset(a,b,sizeof(a))
typedef long long ll;
using namespace std;
#define mm(a,b) memset(a,b,sizeof(a))
typedef long long ll;
const long long mod = 1e9+7;
const int maxn = 1e3+10;
const int inf = 0x3f3f3f3f;


int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        int degree[500]={0};
        int n,m,k;
        scanf("%d %d %d",&n,&m,&k);
        while(m--)
        {
            int a,b;
            scanf("%d %d",&a,&b);
            degree[a]++;
            degree[b]++;
        }
        int flag=1;
        for(int i=1;i<=n;i++)
        {
            if(degree[i]<k)
            {
                flag=0;
                break;
            }
        }
        if(!flag) printf("No\n");
        else printf("Yes\n");
    }


    return 0;
}

猜你喜欢

转载自www.cnblogs.com/Tangent-1231/p/11408532.html
今日推荐