hdu2094 STLset applications

Topic links: http://acm.hdu.edu.cn/showproblem.php?pid=2094

Not after, I saw the solution to a problem before the solution to a problem they did not see a little ignorant force? This is a question that is never lost who is winning, if there is such a person, indicating the presence of the winner, if there is more than words can not decide who is the winner.

code show as below:

. 1 #include <bits / STDC ++ H.>
 2  the using  namespace STD;
 . 3  int n-;
 . 4  int main ()
 . 5  {
 . 6      // The freopen ( "input.txt", "R & lt", stdin);
 . 7      // The freopen ( " output.txt "," W ", stdout); 
. 8      STD :: :: iOS sync_with_stdio ( to false );
 . 9      String a, B;
 10      SET < String > S1, s2; // S1 included in all competition, s2 All people are losing 
11      the while (cin >> the n-&&n)
12     {
13         while(n--)
14         {
15             cin>>a>>b;
16             s1.insert(a);
17             s1.insert(b);
18             s2.insert(b);
19         }
20         if(s1.size()-s2.size() == 1)printf("Yes\n");
21         else printf("No\n");
22         s1.clear();
23         s2.clear();
24     }
25     return 0;
26 } 

 

 

Guess you like

Origin www.cnblogs.com/randy-lo/p/12609672.html