zoj 3710 暴力
2013-05-13 16:46
423 查看
我没想到 暴力 可以过 真是一个水啊 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5013 #include<iostream> #include<stdio.h> #include<cstring> #include<algorithm> using namespace std; int vis[110][110]; int main( ) { int T,N,M,K,u,v; scanf("%d",&T); while( T-- ) { scanf("%d%d%d",&N,&M,&K); memset( vis,false,sizeof(vis) ); for( int i = 1; i <= M; i++ ) { scanf("%d%d",&u,&v); vis[u][v] = true; vis[v][u] = true; } int res = 0; bool fell = true; while( fell ) { fell = false; for( int i = 0; i < N; i++ ) for( int j = i + 1;j < N; j++ ) { if( vis[i][j] )continue; int ans = 0; for( int k = 0; k < N; k++ ) if( vis[i][k] && vis[j][k] )ans++; if( ans >= K ) { vis[i][j] = true; vis[j][i] = true; res++; fell = true; } } } printf("%d\n",res); } }
相关文章推荐
- 带技巧的暴力-ZOJ 3710 [Friends
- Friends ZOJ - 3710(暴力)
- ZOJ Problem Set - 3710 Friends(暴力)
- ZOJ-3710-Friends【10th浙江省赛】【暴力】
- ZOJ 3710 Friends(暴力)
- [ACM_暴力] ZOJ 3710 [Friends 共同认识 最终认识 暴力]
- ZOJ 3710 friends(暴力 枚举 水)
- ZOJ 3710 水暴力
- ZOJ 3710 Friends(暴力)
- ZOJ 3710 Friends(暴力或map)
- ZOJ-3710-Friends
- ZOJ 1610 Count the Colors(线段树lazy+暴力统计)
- zoj 3758 Singles' Day(暴力)
- Zoj 3984 Marjar Cola ( 暴力
- 暴力,组合数学(ZOJ 3779,Chessboard and Flowers)
- Zoj 1610 Count the Colors (线段树+区间更新+暴力计数)
- zoj 3710 Friends
- zoj 3745 Salary Increasing 暴力
- ZOJ 1610 Count the Colors(暴力或者线段树)
- zoj 3710