赞
踩
展开全部
比如有十个糖果,按照2:3:5的比例分配给三个小e68a84e8a2ad62616964757a686964616f31333363366231孩public class luck {
public static List candy = new ArrayList();
public static List child1 = new ArrayList();
public static List child2 = new ArrayList();
public static List child3 = new ArrayList();
// 2:3:5
public static void main(String[] args) {
candy.add("糖果1");
candy.add("糖果2");
candy.add("糖果3");
candy.add("糖果4");
candy.add("糖果5");
candy.add("糖果6");
candy.add("糖果7");
candy.add("糖果8");
candy.add("糖果9");
candy.add("糖果10");
int count = 10;
for (int i = 0; i
int math = (int) (Math.random() * count);
child1.add(candy.get(math));
candy.re
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。