Thinking problems, as long as the final judge the degree of each point of> = k can be.
#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; }