import java.io.*;
import java.util.Random;
class num
{
public static void main(String[]args)
{
//声明一个随机数组
int sjsh[]=new int[7];
int sum;
try
{
InputStreamReader a=new InputStreamReader(System.in);
BufferedReader b=new BufferedReader(a);
System.out.println ("欢迎使用齐鲁风采30选7彩票随机系统!");
System.out.print ("请选择投注数:");
String s=b.readLine();
int sh=Integer.parseInt(s);
//给随机数组赋随机值 且 保证没有重复
for (int i = 0; i<sh; i++)
{
for (int j = 0; j<7; j++)
{
Random rnd = new Random();
sjsh[j] = rnd.nextInt(31);
switch(j)
{
case 0:;break;
case 1:
{
if(sjsh[j]==sjsh[j-1])
j--;
};break;
case 2:
{
if(sjsh[j]==sjsh[j-1]||sjsh[j]==sjsh[j-2])
j--;
};break;
case 3:
{
if(sjsh[j]==sjsh[j-1]||sjsh[j]==sjsh[j-2]||sjsh[j]==sjsh[j-3])
j--;
};break;
case 4:
{
if(sjsh[j]==sjsh[j-1]||sjsh[j]==sjsh[j-2]||sjsh[j]==sjsh[j-3]||sjsh[j]==sjsh[j-4])
j--;
};break;
case 5:
{
if(sjsh[j]==sjsh[j-1]||sjsh[j]==sjsh[j-2]||sjsh[j]==sjsh[j-3]||sjsh[j]==sjsh[j-4]||sjsh[j]==sjsh[j-5])
j--;
};break;
case 6:
{
if(sjsh[j]==sjsh[j-1]||sjsh[j]==sjsh[j-2]||sjsh[j]==sjsh[j-3]||sjsh[j]==sjsh[j-4]||sjsh[j]==sjsh[j-5]||sjsh[j]==sjsh[j-6])
j--;
};break;
}
}
//冒泡排序
for (int k = 0; k<7; k++)
{
for (int j = 6; j>k; j--)
{
if(sjsh[j]<sjsh[j-1])
{
sum=sjsh[j];
sjsh[j]=sjsh[j-1];
sjsh[j-1]=sum;
}
}
}
for (int j = 0; j<7; j++)
System.out.print (sjsh[j]+"\t");
System.out.println ();
}
}
catch (Exception ex)
{
System.out.println ("您的输入有错误!");
}
}
}