zoukankan      html  css  js  c++  java
  • 第二题 已知有十六支男子足球队参加2008 北京奥运会。写一个程序,把这16 支球队随机分为4 个组。采用List集合和随机数 2008 北京奥运会男足参赛国家: 科特迪瓦,阿根廷,澳大利亚,塞尔维亚,荷兰,尼日利亚、日本,美国,中国,新西 兰,巴西,比利时,韩国,喀麦隆,洪都拉斯,意大利

    package com.hanqi.test;
    
    import java.util.ArrayList;
    import java.util.List;
    import java.util.Random;
    
    public class Listtest {
        
          public static void main(String[] args)
          {
              List<String> ls=new ArrayList<>();
              
              ls.add(new String ("科特迪瓦"));
              ls.add(new String("阿根廷"));
              ls.add(new String("澳大利亚队"));
              ls.add(new String("塞尔维亚队"));
              ls.add(new String("荷兰队"));
              ls.add(new String("尼日利亚队"));
              ls.add(new String("日本队"));
              ls.add(new String("美国队"));
              ls.add(new String("中国队"));
              ls.add(new String("新西兰队"));
              ls.add(new String("巴西队"));
              ls.add(new String("比利时队"));
              ls.add(new String("韩国队"));
              ls.add(new String("喀麦隆队"));
              ls.add(new String("洪都拉斯队"));
              ls.add(new String("意大利队"));
              
              Random ra=new Random();
              
              String str;
              for(int j=1;j<5;j++)
              {
                  System.out.print(""+j+"组:"+" ");
                  for(int i=0;i<4;i++)
                  {
                      str=ls.get(ra.nextInt(ls.size()));
                      System.out.print("  "+str);
                      ls.remove(str); 
                  }
                  System.out.println("
    ");
              }
              
              
          }
    
    }

  • 相关阅读:
    pt-heartbeat(percona toolkit)
    pt-find使用
    pt-duplicate-key-checker使用
    Unity3D 之IAP
    Unity3D 之IAP
    JDK环境变量
    Android环境变量的设置(详细图解版)
    Android sdk 更新失败解决方发整理
    unity开发android游戏(一)搭建Unity安卓开发环境
    Unity使用 UnityVS+VS2013 调试脚本
  • 原文地址:https://www.cnblogs.com/diaozhaojian/p/5933073.html
Copyright © 2011-2022 走看看