hdu 6152 Friend-Graph
来源:互联网 发布:剑三喵萝脸型数据 编辑:程序博客网 时间:2024/06/03 22:41
3个人互相是朋友或者不是朋友就输出bad 。。。第一行如果3个1,肯定是bad 稍微推一下就知道,下面的会互相矛盾。
5以内的三重循环暴力一下。
#include <cstdio>#include <cstring>#include <algorithm>using namespace std;int main(){ int t,a[6][6]; scanf("%d",&t); while(t--) { int n,b; memset(a,0,sizeof(a)); scanf("%d",&n); if(n>=6) { for(int i=n-1;i>=1;i--) for(int j=1;j<=i;j++) scanf("%d",&b); printf("Bad Team!\n"); } else { int flag=1; for(int i=1;i<n;i++) for(int j=i+1;j<=n;j++) { scanf("%d",&a[i][j]); a[j][i]=a[i][j]; } for(int i=1;i<=n;i++) { for(int j=1;j<=n;j++) { if(i==j)continue; for(int k=1;k<=n;k++) { if(k==j||k==i)continue; if(a[i][j]==a[j][k]&&a[i][j]==a[i][k])flag=0; } } } if(flag==0)printf("Bad Team!\n"); else printf("Great Team!\n"); } }}
阅读全文
0 0
- HDU 6152 Friend-Graph
- HDU 6152 Friend-Graph
- hdu-6152 Friend-Graph
- HDU 6152 Friend-Graph
- HDU 6152 Friend-Graph
- hdu 6152 Friend-Graph
- HDU-6152Friend-Graph
- HDU 6152 Friend-Graph
- Hdu 6152 Friend-Graph【暴力】
- HDU 6152-Friend-Graph(ccpc)
- HDU 6152 Friend-Graph(定理)
- Hdu 6152 Friend-Graph(Ramsey定理)
- HDU 6152 Friend-Graph (最大团)
- HDU 6152 Friend-Graph(暴力)
- HDU-6152 Friend-Graph (思维+暴力)
- hdu 6152 Friend-Graph(ccpc)
- HDU 6152 Friend-Graph (CCPC2017)
- hdu 6152 Friend-Graph(拉姆齐定理)
- 二叉树打印节点和为某值的全部路径
- 基于django封装的常用装饰器和函数
- 多条目加载
- MFC1-纯手写一个程序
- hdu-6154
- hdu 6152 Friend-Graph
- ADB server didn't ACK 解决方法
- JavaScript每过一段时间执行一个函数
- React初识
- Hbase学习总结一 环境部署
- Python批量修改文件名
- java算法之简单的Implement strStr
- java中常用集合
- Hbase流程