-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDiscrete.java
More file actions
57 lines (53 loc) · 1.03 KB
/
Discrete.java
File metadata and controls
57 lines (53 loc) · 1.03 KB
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
48
49
50
51
52
53
54
55
56
57
public class Discrete
{
public static void main( String[] args )
{
int total = 1;
int exp = 1;
int i = 0;
int j = 0;
hope(total, exp, j, i);
}
public static void hope(int total, int exp, int j, int i)
{
int stop = 4;
if( i<=stop )
{
if( i==0 )
{
exp=1;
result(total, exp, j, i);
}
else
{
j=i;
if(j==1)
{
exp=2;
result(total, exp, j, i);
}
else if(j<=stop)
{
exp = exp*2;
j++;
result(total, exp, j, i);
}
else
{
j++;
result(total, exp, j, i);
}
}
}
else
{
System.out.println(total);
}
}
public static void result(int total, int exp, int j, int i)
{
total = total*(exp + 3);
i++;
hope(total, exp, j, i);
}
}