A-小红的葫芦_牛客周赛 Round 47 (nowcoder.com)
思想
我是用一个map做的
#include<bits/stdc++.h>
using namespace std;
map<int, int>mp;int flag1, flag2;
int main()
{
int n = 5;
for (int i = 0; i < n; i++)
{
int x; cin >> x;
mp[x]++;
}
for (auto& it : mp)
{
if (it.second==3)
{
flag1 = 1;
}
if (it.second == 2)
{
flag2 = 1;
}
}
if (flag1 && flag2) cout << "YES";
else cout << "NO";
return 0;
}