codeforces-1025 A Doggo Recoloring

 1 #include <iostream>
 2 #include <algorithm>
 3 #include <vector>
 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 }

 

posted @ 2018-08-22 10:09  Asurudo  阅读(292)  评论(0编辑  收藏  举报