其他分享
首页 > 其他分享> > L1-072 刮刮彩票 (20 分)

L1-072 刮刮彩票 (20 分)

作者:互联网

import java.util.HashMap;
import java.util.Scanner;

public class Main {
static int x[][]=new int[3][3];
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
int x1[]={36,37,38,39,40,41,42,43,44};
int x2[]={0,0,0,0,0,0,10000,36,720,360,80,252,108,72,54,180,72,180,119,36,306,1080,144,1800,3600};
int sum=0;
for (int i = 0; i < x.length ; i++) {
for (int j = 0; j < x[i].length; j++) {
x[i][j]=scanner.nextInt();
sum+=x[i][j];
}
}
for (int i = 0; i < x.length ; i++) {
for (int j = 0; j < x[i].length; j++) {
if (x[i][j]==0){
x[i][j]=9-sum%x1.length;
}
}
}
for (int i = 0; i <3 ; i++) {
int c1=scanner.nextInt();
int c2=scanner.nextInt();
System.out.println(x[c1-1][c2-1]);
}
int c3=scanner.nextInt();
int flag=0;
if(c3>=1&&c3<=3){
for (int j = 0; j < 3; j++) {
flag+=x[c3-1][j];
}
}
if(c3>=4&&c3<=6){
for (int i = 0; i <3 ; i++) {
flag+=x[i][c3-4];
}
}
if(c3==7){
flag=x[0][0]+x[1][1]+x[2][2];
}
if(c3==8){
flag=x[0][2]+x[1][1]+x[2][0];
}
System.out.println(x2[flag% x2.length]);
}
}

标签:072,scanner,int,flag,++,length,L1,c3,20
来源: https://www.cnblogs.com/aspk/p/16177088.html