import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] lottoNum= new int[6]; //배열 초기화
for(int i =0;i<=5;i++) { //6번 반복
int count=0; //중복된 값을 확인하기 위함
int landomNum = (int)(Math.random()*45+1); //1부터 45까지의 수중 랜덤 숫자 초기화
for(int j=0;j<=5;j++) {
if(lottoNum[j]==landomNum) { //인덱스 0~5 까지 수중 난수와 같은 값이 있을경우 count++
count++;
}
}
if(count == 0) { //중복된 수가 없을경우 난수 저장
lottoNum[i] = landomNum;
}
else { //중복된 수가 있을경우 i--를 통해 다시 실행
i--;
}
}
Scanner sc = new Scanner(System.in);
System.out.println("============456회차 로또============");
System.out.println("출력을 원하는 등수:");
int choice=sc.nextInt();
//등수에 따라
switch(choice) {
case 1: System.out.println("---------1등---------- ");
for(int i = 0; i < 6; i++) {
System.out.print(lottoNum[i]+"\t");
}
System.out.println();
break;
case 2:System.out.println("---------2등---------- ");
for(int i = 0; i < 6; i++) {
for(int j = 0; j < 6; j++) {
if(j == i) {
System.out.print("X"+"\t");
}
else System.out.print(lottoNum[j]+ "\t");
}
System.out.println();
}
break;
case 3: System.out.println("---------3등---------- ");
for(int i = 0; i < 6; i++) {
for(int j = i+1; j < 6; j++) {
for(int h=0;h<6;h++) {
if(i == h) {
System.out.print("X"+"\t");
}
else if(j==h) {
System.out.print("X"+"\t");
}
else System.out.print(lottoNum[h]+ "\t");
}
System.out.println();
}
}
break;
case 4:System.out.println("---------4등---------- ");
for(int i = 0; i < 6; i++) {
for(int j = i+1; j < 6; j++) {
for(int k = j+1; k < 6; k++) {
for(int h=0;h<6;h++) {
if(j == h) {
System.out.print("X"+"\t");
}
else if(i==h) {
System.out.print("X"+"\t");
}
else if(k==h) {
System.out.print("X"+"\t");
}
else System.out.print(lottoNum[h]+ "\t");
}
System.out.println();
}
}
}
break;
case 5:System.out.println("---------5등---------- ");
for(int i = 0; i < 6; i++) {
for(int j = i+1; j < 6; j++) {
for(int k = j+1; k < 6; k++) {
for(int q=k+1;q<6;q++) {
for(int h=0;h<6;h++) {
if(j == h) {
System.out.print("X"+"\t");
}
else if(i==h) {
System.out.print("X"+"\t");
}
else if(k==h) {
System.out.print("X"+"\t");
}
else if(q==h) {
System.out.print("X"+"\t");
}
else System.out.print(lottoNum[h]+ "\t");
}
System.out.println();
}
}
}
}
break;
}
}
}