using System;
//写的不太严格,直接用14张牌来抽了,1-13,大小王为0,没有判断相同的不能超过4张,为0的相同不能超过两张。
namespace _201919144122WeiXu
{
class Program
{
static void Main(string[] args)
{
int[] a = new int[5];
int count = 0;
Random random = new Random();
for(int i = 0;i <= 4;i++)
{
a[i] = random.Next(0,13);
}
for(int i = 0;i <= 4;i++)
{
Console.Write(a[i]+ " ");
}
Console.Write("\n");
for (int i = 0; i <= 4; i++)
{
for (int j = 0; j < 5 - i - 1; j++)
{
if (a[j] > a[j + 1])
{
int b = 0;
b = a[j];
a[j] = a[j + 1];
a[j + 1] = b;
}
}
}
for (int i = 0; i < 5; i++)
{
Console.Write(a[i] + " ");
}
for (int i = 0; i <=4; i++)
{
for (int j = i + 1; j <=4; j++)
{
if ((a[i] == a[j]) && (a[i]!= 0) && a[j] != 0)
{
Console.WriteLine("不是顺子\n");
return;
}
}
}
for (int i = 0; i < 5; i++)
{
if (a[i] == 0)
count++;
}
if(count ==0)
{
if(a[4]-a[0]==4)
{
Console.WriteLine("为顺子");
}
else
{
Console.WriteLine("不是顺子");
}
return;
}
if (count == 1)
{
if (a[4] - a[1] == 4 || a[4] - a[1]==3)
{
Console.WriteLine("为顺子");
}
else
{
Console.WriteLine("不是顺子");
}
return;
}
if (count == 2)
{
if (a[4] - a[2] == 4 || a[4] - a[2] == 3 || a[4] - a[2] == 2)
{
Console.WriteLine("为顺子");
}
else
{
Console.WriteLine("不是顺子");
}
return;
}
}
}
}