hdu 2094 产生冠军
2013-08-12 17:21
399 查看
题目:
http://acm.hdu.edu.cn/showproblem.php?pid=2094
产生冠军的前提是有且只有一个人赢(貌似是废话)......
源代码:
http://acm.hdu.edu.cn/showproblem.php?pid=2094
产生冠军的前提是有且只有一个人赢(貌似是废话)......
源代码:
#include <iostream> #include<stdio.h> #include<cstring> using namespace std; char temp1[30],temp2[30]; char topo[2005][30]; int win[2005];//记录输赢,-1表示赢,0表示输 int main() { // freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); int n,flag1,flag2,ans; while(scanf("%d",&n)){ if(n==0) break; int count=0; memset(win,-1,sizeof(win)); for(int i=0;i<n;i++){ scanf("%s %s",temp1,temp2); flag1=flag2=0; for(int j=0;j<count;j++){ if(strcmp(topo[j],temp1)==0) flag1=1; //当前选手之前没出现过 if(strcmp(topo[j],temp2)==0){ flag2=1; win[j]=0; } } if(flag1==0) strcpy(topo[count++],temp1); if(flag2==0){ win[count]=0; strcpy(topo[count++],temp2); } } ans=0; for(int i=0;i<count;i++){ if(win[i]==-1) ans++; } if(ans==1)printf("Yes\n"); else printf("No\n"); } return 0; }
相关文章推荐
- HDU 2094 产生冠军
- hdu 2094 产生冠军(水题,拓扑排序)
- [HDU] 2094 产生冠军(拓扑排序+map)
- hdu 2094 产生冠军
- hdu 2094 产生冠军 拓扑排序
- HDU 2094 产生冠军
- HDU 2094 产生冠军
- HDU 2094 产生冠军 map
- HDU 2094 产生冠军 hash 水题
- HDU——2094产生冠军
- hdu 2094 产生冠军
- HDU 2094 产生冠军
- HDU 2094 产生冠军
- HDU 2094 产生冠军
- Hdu 2094 产生冠军
- hdu-2094-产生冠军(map&拓扑)
- HDU 2094 产生冠军(map)
- HDU 2094 -- 产生冠军 (邻接表或直接比较)
- HDU 2094 产生冠军
- hdu 2094 产生冠军