import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;
/**
* 双色球
* 1.6个随机不重复的红球(1-)33
* 2.1个篮球(1-15)
* @author E-mail: 543363559@qq.com
* @date 2017年4月22日 上午9:12:48
*/
public class DoubleBail {
public static void main(String[] args){
System.out.println("欢迎来到澳门双色球赌博中心");
System.out.println("请输入你的选择号码,默认最后一位为蓝球");
int[] MyBalls = new int [7];
Scanner sc = new Scanner(System.in);
for (int i = 0; i < MyBalls.length; i++) {
MyBalls[i] = sc.nextInt();
}
Arrays.sort(MyBalls, 0, MyBalls.length-1);
System.out.println(Arrays.toString(MyBalls));
int[] RedBalls = new int [6];
Random r =new Random();
boolean[] flag = new boolean[33];
for (int i = 0; i < RedBalls.length; i++) {
int index;
do{
index = r.nextInt(32)+1;
}while(flag[index]);
flag[index] = true;
RedBalls[i] = index;
}
int BlueBalls = r.nextInt(15)+1;
Arrays.sort(RedBalls);
int[] systemBalls = Arrays.copyOf(RedBalls, RedBalls.length+1);
systemBalls[systemBalls.length-1] = BlueBalls;
System.out.println(Arrays.toString(systemBalls));
int score = 0;
for (int i = 0; i < MyBalls.length-1; i++) {
for (int j = 0; j < systemBalls.length-1; j++) {
if(MyBalls[i] == systemBalls[j]){
score++;
}
}
}
if(MyBalls[MyBalls.length-1]==systemBalls[MyBalls.length-1]){
score++;
}
System.out.println("您中了"+score+"个号");
}
}