hdu2454Degree Sequence of Graph G
来源:互联网 发布:淘宝刷流量会被降权 编辑:程序博客网 时间:2024/06/16 17:28
这个题是给你一些结点的度数,让我们来判断是否可将其简单图化。
这道题用到的是Havel定理,代码如下
#include<cstdio>#include<algorithm>using namespace std;const int maxn = 1010;int n,m,a[maxn];int cmp(int a,int b){ return a>b;}int main(){ scanf("%d",&n); for(int i=1; i<=n; i++) { scanf("%d",&m); for(int i=0; i<m; i++) scanf("%d",&a[i]); for(int i=0;i<m;i++) { sort(a+i,a+m,cmp); for(int j=i+1; j<m; j++) { if(a[j]>0)a[j]--,a[i]--; if(a[i]==0)break; } } int ok=1; for(int i=0; i<m; i++) if(a[i]>0) { ok=0; break; } if(ok)printf("yes\n"); else printf("no\n"); }}
0 0
- hdu2454Degree Sequence of Graph G
- hdu2454Degree Sequence of Graph G
- hdu 2454 Degree Sequence of Graph G
- hdu 2454 Degree Sequence of Graph G
- Degree Sequence of Graph G(Hdu_oj 2454)
- hdu 2454 Degree Sequence of Graph G (判断简单图)
- hdu2454 Degree Sequence of Graph G(havel定理)
- HDU 2454 Degree Sequence of Graph G(Heavel定理)
- HDU 2454 Degree Sequence of Graph G(Havel定理 判断简单图的存在)
- HDU 2454 Degree Sequence of Graph G (可简单图化的判定 havel定理)
- HDOJ题目2454 Degree Sequence of Graph G(判断是否是简单图)
- HDU 2454 Degree Sequence of Graph G(Havel-Hakimi定理,图论基础)
- hdu2454 Degree Sequence of Graph G (Havel-Hakimi定理,可图化判定)
- HDOJ2454(Degree Sequence of Graph G)(Havel-Hakimi定理判断所给序列是否可化成简单图)
- codeforces 724G. Xor-matic Number of the Graph
- codeforces 724G. Xor-matic Number of the Graph
- [Codeforces 724G. Xor-matic Number of the Graph]线性基+计数
- Graph Of Zhuper
- IOS网络学习-5、GET请求和POST请求
- LINE_TO_STRING
- 线程池(上)
- python检测QQ是否在线
- linux 性能测试工具
- hdu2454Degree Sequence of Graph G
- Ubuntu 12.04下安装OpenCV 2.4.2
- 浅谈Android五大布局
- iOS 画虚线
- TCP长连接,短连接
- grub2无法启动系统
- FFMPEG之时间基
- JVM java虚拟机内存模型
- 钢条切割问题