1.要求三十个数
2.要求不重复
package yunsuan; import java.util.Random; public class yunsuan{ public static void main(String[]args) { int u=1; Random r=new Random(); int []p1=new int[30]; int []p2=new int[30]; for(int i=0;i<30;i++) { int a=r.nextInt(100); int b=r.nextInt(100); p1[i]=a;p2[i]=b; for(int j=0;j<i;j++) { if(p1[j]==p1[i]&&p2[j]==p2[i]) u=0; } if(u==1) { int c=r.nextInt(4); switch(c) { case 0: System.out.println(a+"+"+b+"="); break; case 1: System.out.println(a+"-"+b+"="); break; case 2: System.out.println(a+"*"+b+"="); break; case 3: System.out.println(a+"+"+b+"="); break; } } } } }