|
import java.util. *;
public class youxi24 {// 24 games
public static void main (String [] args)
{
Ranch
int A [] = new int [13]; // 4 cards defined
int B [] = new int [13];
int C [] = new int [13];
int D [] = new int [13];
Random a = new Random ();
Random b = new Random ();
Random c = new Random ();
Random d = new Random ();
for (int j = 0; j <5; j ++) {// Draw 5 times
for (int i = 0; i <13; i ++) {
A [i] = Math.abs (a.nextInt ()% 12) +1;
B [i] = Math.abs (a.nextInt ()% 12) +1;
C [i] = Math.abs (a.nextInt ()% 12) +1;
D [i] = Math.abs (a.nextInt ()% 12) +1;
Ranch
if ((A [i] + B [i] -C [i]) * D [i] == 24) {
System.out.print ("(" + A [i] + "+" + B [i] + "-" + C [i] + ")" + "*" + D [i] + "= 24" );
System.out.println ();
}
}
}}
I do n’t know what the problem is, but I want to smoke 5 times
Each time the result is displayed, it is either 1 or 2, 3, 4, 6 times, or 1 time. |
|