-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_array02.java
More file actions
47 lines (43 loc) · 992 Bytes
/
test_array02.java
File metadata and controls
47 lines (43 loc) · 992 Bytes
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
*
*/
/**
* @author DELL
* Project Name: Java_learn
* Class Name: test_array02
* date: 2019年9月1日{time}
*/
public class test_array02 {
public static int a[]=new int[14];
public static int visit[]=new int[14];
public static int sum=0;
public static void main(String[] args){
dfs(1);
System.out.println(sum);
}
public static void dfs(int n)
{
if(n>3 && a[1]+a[2]!=a[3])
return;
if(n>6 && a[4]-a[5]!=a[6])
return;
if(n>9 && a[7]*a[8]!=a[9])
return;
if(n>12 && a[12]*a[11]==a[10])
{
sum++;
return;
}
for(int i=1;i<14;i++)
{
if(visit[i]==0)
{
visit[i]=1;
a[n]=i;
dfs(n+1);
visit[i]=0;
}
}
return;
}
}