codeforces-1025 A Doggo Recoloring

 1 #include 
 2 #include 
 3 #include 
 4 
 5 using namespace std;
 6 
 7 int main()
 8 {
 9     int n;
10     while(cin >> n)
11     {
12         if(n==1)
13         {
14             cout << "Yes" << endl;
15             continue;
16         }
17         vector<int> v(26,0);
18         while(n --)
19         {
20             char tmp_color;
21             cin >> tmp_color;
22             v[tmp_color-'a'] ++;
23         }
24         int multi_color_num = 0;
25         int single_color_num = 0;
26         for(int i = 0;i < 26;i ++)
27         {
28             if(v[i]==1)
29                 single_color_num ++;
30             else if(v[i]>=2)
31                 multi_color_num ++;
32         }
33         if(multi_color_num)
34             cout << "Yes" << endl;
35         else
36             cout << "No" << endl;
37     } 
38     return 0;
39 }

 

转载于:https://www.cnblogs.com/Asurudo/p/9516017.html

你可能感兴趣的:(codeforces-1025 A Doggo Recoloring)