package com.caipiao;
import java.util.Random;
import java.util.Scanner;
public class Caipiao {
public static void main(String[] args) {
int sysblueballnum;
int[] sysredballnum = new int[6];
int userblueballnum;
int[] userredballnum = new int[6];
int blueball = 0;
int redballcount = 0;
Random r = new Random();
Scanner s = new Scanner(System.in);
sysblueballnum = r.nextInt(16)+1;
int[] rednum = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33};
for(int i=0;i<sysredballnum.length;i++) {
while(true) {
int index = r.nextInt(33);
if(rednum[index] != 0) {
sysredballnum[i] = rednum[index];
rednum[index] = 0;
break;
}
}
}
System.out.println("双色球×××选好开始,祝你好运!");
System.out.println("请选择蓝球,16选1!");
userblueballnum = s.nextInt();
System.out.println("请选择红球,33选6!");
for(int i=0;i<userredballnum.length;i++) {
userredballnum[i] = s.nextInt();
}
if(userblueballnum == sysblueballnum) {
blueball = 1;
}
for(int i=0;i<userredballnum.length;i++) {
for(int j=0;j<sysredballnum.length;j++) {
if(userredballnum[i] == sysredballnum[j]) {
redballcount++;
break;
}
}
}
if(blueball==1 && redballcount==6) {
System.out.println("恭喜你中了500W!");
}else if(redballcount == 6) {
System.out.println("恭喜你中了2等奖,100W");
}else if(blueball==1 && redballcount==5) {
System.out.println("恭喜你中了3等奖,3000快");
}else if(redballcount==5 || (blueball==1 && redballcount==4)) {
System.out.println("恭喜你中了4等奖,200快");
}else if(redballcount==4 || (blueball==1 && redballcount==3)) {
System.out.println("恭喜你中了5等奖,10快");
}else if((blueball==1 && redballcount==1) || blueball==1 || (blueball==1 && redballcount==2)) {
System.out.println("恭喜你中了6等奖,5快");
}else {
System.out.println("很遗憾,您没中奖!");
}
for(int i=0;i<sysredballnum.length-1;i++) {
for(int j=0;j<sysredballnum.length-1-i;j++) {
if(sysredballnum[j] > sysredballnum[j+1]) {
int tmp = sysredballnum[j+1];
sysredballnum[j+1] = sysredballnum[j];
sysredballnum[j] = tmp;
}
}
}
System.out.println("本期的中奖号码为:");
System.out.print("红球号码:");
for(int i=0;i<sysredballnum.length;i++) {
System.out.print(sysredballnum[i]+" ");
}
System.out.println("本期蓝球中奖号码:"+sysblueballnum);
}
}