HDU 4940 Destroy Transportation system (瞎搞)
来源:互联网 发布:在线网络视频下载工具 编辑:程序博客网 时间:2024/04/29 08:56
解题思路:
题目要求是否存在集合S使得 Y < X ,因此让T集合中点数目尽量少,使得Y尽量小,枚举即可。
#include <iostream>#include <cstring>#include <cstdlib>#include <cstdio>#include <vector>#include <map>#include <algorithm>#define LL long long#define FOR(i,x,y) for(int i=x;i<=y;i++)using namespace std;const int maxn = 200 + 10;int B[maxn][maxn];int D[maxn][maxn];int main(){int T , kcase = 1;int N , M;scanf("%d",&T);while(T--){scanf("%d%d",&N,&M);memset(B,0,sizeof(B));memset(D,0,sizeof(D));int u , v , b , d; for(int i=1;i<=M;i++){scanf("%d%d%d%d",&u,&v,&b,&d);B[u][v] = b;D[u][v] = d;}int F = 0;for(int i=1;i<=N;i++){int x = 0 , y = 0;for(int j=1;j<=N;j++){x += B[i][j] + D[i][j];y += B[j][i];}if(x < y) { F = 1; break;}}if(F) printf("Case #%d: unhappy\n",kcase++);else printf("Case #%d: happy\n",kcase++);}return 0;}
0 0
- HDU 4940 Destroy Transportation system (瞎搞)
- HDU 4940(杭电多校#7 1006) Destroy Transportation system(瞎搞)
- 【瞎搞】HDU4940 Destroy Transportation system
- HDU-4940-Destroy Transportation system
- hdu 4940 Destroy Transportation system(sap dfs)
- HDU 4940 Destroy Transportation system(上下界网络流)
- HDU 4940 - Destroy Transportation system(网络流)
- HDU 4940 Destroy Transportation system 规律题
- HDU 4940 Destroy Transportation system(图论)
- [HDOJ 4940] Destroy Transportation system [最大流]
- HDU4940 Destroy Transportation system
- hdu4940 Destroy Transportation system
- hdu 4940 Destroy Transportation system( 无源汇上下界网络流的可行流判断 )
- HDU 4940 Destroy Transportation system 无源汇有上下界的网络流
- HDU 5000 Clone(瞎搞)
- HDU 1990 Monkey Vines (瞎搞)
- UVA 11228 - Transportation system.
- 【瞎搞】 HDU 1986 Encoding
- 关于JS跨域请求的若干方式
- bitset的使用
- 【Android學習專題】視覺介面篇:Android布局及属性归总(查询用)《转自cnblog》
- eys4fhf韩国
- Android修炼之道——设置状态栏颜色
- HDU 4940 Destroy Transportation system (瞎搞)
- MKNetworkKit 详细介绍
- oc基础知识
- 降低百度推广费用
- c/c++ 数字字符串互转
- c++中switch不支持string
- VS2013 产品密钥 – 所有版本
- myeclipse项目红叉问题解决经验
- poj 1113凸包入门