hdu_2094 产生冠军(set)
1 #include<iostream> 2 #include<set> 3 #include<string> 4 using namespace std; 5 int main(){ 6 set<string>A,B; 7 string s1,s2; 8 int n; 9 while(cin>>n&&n){ 10 for(int i=0;i<n;i++){ 11 cin>>s1>>s2; 12 A.insert(s1); A.insert(s2); //所有参赛者放入集合A 13 B.insert(s2); //失败者放入集合B 14 } 15 if(A.size()-B.size()==1){ 16 cout<<"Yes"<<endl; 17 }else 18 cout<<"No"<<endl; 19 A.clear();B.clear(); 20 } 21 return 0; 22 }