hdu 2094
来源:互联网 发布:北京编程培训学校 编辑:程序博客网 时间:2024/06/02 04:12
好气
#include <stdio.h>#include <algorithm>#include <math.h>#include <string.h>#include <vector>#include <queue>#include <map>#include <stack>#include <iostream>#define pi acos(-1.0)#define INF 0x3f3f3f3fusing namespace std;#define ll long longmap<string,int> mp;const int maxn=1010;vector<int> e[maxn];int deg[maxn];int main(){ freopen("C:\\Users\\Administrator\\Desktop\\a.txt","r",stdin); //ios::sync_with_stdio(false); //freopen("C:\\Users\\Administrator\\Desktop\\b.txt","w",stdout); int n; while(scanf("%d",&n),n) { mp.clear(); for(int i=0;i<=maxn;i++) e[i].clear(); memset(deg,0,sizeof deg); char c1[maxn],c2[maxn]; int tot=0; for(int i=0;i<n;i++) { scanf("%s",c1); if(!mp[c1]) mp[c1]=++tot; scanf("%s",c2); if(!mp[c2]) mp[c2]=++tot; int a=mp[c1],b=mp[c2]; e[a].push_back(b); deg[b]++; } int cnt=0; for(int i=1;i<=tot;i++) if(deg[i]==0) cnt++; if(cnt!=1) printf("No\n"); else printf("Yes\n"); } return 0;}
阅读全文
0 0
- hdu 2094
- HDU 2094
- hdu 2094
- hdu 2094
- hdu 2094
- hdu 2094
- hdu 2094
- hdu 2094 产生冠军
- HDU 2094 拓扑
- hdu 2094 产生冠军
- hdu 2094 产生冠军
- HDU 2094 产生冠军
- HDU-2094产生冠军
- HDU 2094 产生冠军
- HDU 2094 产生冠军
- hdu 2094 产生冠军
- HDU 2094:产生冠军
- HDU 2094 产生冠军
- rocketmq入门使用
- Java 多线程(PART VI) 线程状态图解
- 2017.10.5 最短母串 思考记录
- centos 安装boost(caffe需要)
- 递归回溯 求N个数的全排列 及 next_permutation的使用
- hdu 2094
- 接水问题
- [BZOJ]3994 [SDOI2015]约数个数和 莫比乌斯 + 分块
- codefoces 868C(二进制,状态压缩)
- 15算法课程 67. Add Binary
- 接口与抽象类的浅析
- HDU 3652 (数位dp)
- 小车调试篇
- 设计模式小结