题目链接:CodeForces 1025A Doggo Recoloring
一直是 Compilation error 编译错误,hash不能做数组名??
特判1 。
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;
typedef long long ll;
const int maxn = 100010;
const int INF = 0x3f3f3f3f;
char a[maxn];
int cnt[30]; //int hash[30];
int main()
{
int n;
cin>>n;
string s;
cin>>s;
if(n==1) // 特判1 QAQ
{
printf("Yes\n");
return 0;
}
for(int i=0;i<n;i++)
cnt[s[i]-'a']++;
int flag = 0;
for(int i=0;i<26;i++)
{
if(cnt[i]>=2)
{
flag = 1;
break;
}
}
if(flag == 1)
printf("Yes\n");
else
printf("No\n");
return 0;
}