本题非常简单,就是比较麻烦,直接上代码了。
#include <iostream>
using namespace std;
int a[6], b[6], ans, t,c[6];
int main()
{
for (int i = 1; i <= 5; i++)
cin >> a[i];
for (int i = 1; i <= 5; i++)
cin >> b[i];
if (a[1] + 1 == a[2] && a[2] + 1 == a[3] && a[3] + 1 == a[4] && a[4] + 1 == a[5])
ans = 6;
if (b[1] == b[2] && b[2] == b[3] && b[3] == b[4] && b[4] == b[5])
{
ans = 5;
if (a[1] + 1 == a[2] && a[2] + 1 == a[3] && a[3] + 1 == a[4] && a[4] + 1 == a[5])
{
if (a[5] == 14)
ans = 1;
else
ans = 2;
}
}
if (ans != 1 && ans != 2)
{
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= 5; j++)
{
if (a[i] == a[j])
c[i]++;
}
}
for (int i = 1; i <= 5; i++)
{
if (c[i] >= 4)
{
ans = 3;
break;
}
}
for(int i=1;i<=5;i++)
for (int j = 1; j <= 5; j++)
{
if (c[i] == 3 && c[j] == 2)
{
ans = 4;
break;
}
}
}
switch (ans)
{
case(0):cout << "FOLD"; break;
case(1):cout << "ROYAL FLUSH"; break;
case(2):cout << "STRAIGHT FLUSH"; break;
case(3):cout << "FOUR OF A KIND"; break;
case(4):cout << "FULL HOUSE"; break;
case(5):cout << "FLUSH"; break;
case(6):cout << "STRAIGHT"; break;
}
return 0;
}