大家好,欢迎来到IT知识分享网。
单循环是指所有参赛队在竞赛中均能相遇一次,最后按各队在竞赛中的得分多少、胜负场次来排列名次。 单循环一般在参赛队不太多,又有足够的竞赛时间才能采用。单循环由于参加竞赛的各队都有相遇比赛的机会, 是一种比较公平合理的比赛制度。 一) 单循环比赛的轮数和场数的计算 |
② 比赛场数:单循环比赛的场数,可用下面的公式计算(简单的数学组合公式):
比赛场数= 队数*(队数-1)/2
如6个队或7个队参加比赛,则比赛场数为:
6 *(6-1)/2 =15(场) 7*(7-1)/2 =21(场)
固定轮转法也叫常规轮转法,是我国传统的编排方法。表17-6为7个队参赛轮次表,它以左边第一号固定不动,逆时针转动,逐一排出。
JAVA 程序如下
public class FootBallTeam { public static void main(String [] args) { String [] team = {"1","2","3","4","5","0"};//参赛的各队 int len = team.length; for(int i=1;i< len;i++) { System.out.println(); System.out.println("第"+i+" 轮"); for(int j=0;j< len/2;j++) { System.out.println(team[j]+" ----- "+ team[len-1-j]); } String temp=team[len-1]; //将最后一队的值赋给临时变量temp for(int k=len-1;k>0;k--) { team[k]=team[k-1]; } team[1]=temp; //将临时变量temp赋给数组的第二值 } } } 运行结果:
C:\java>java FootBallTeam
从1985年起,世界性比赛多采用“贝格”“编排法。其优点是单数队参加时可避免第二轮的轮空队从第四轮起每场都与前一轮的轮空队比赛的不合理现象。
采用“贝格尔”编排法,编排时如果参赛队为双数时,把参赛队数分一半(参赛队为单数时,最后以“0”表示形成双数),前一半由1号开始,自上而下写在左边;后一半的数自上而下写在右边,然后用横线把相对的号数连接起来。这即是第一轮的比赛。
第一轮 |
第二轮 |
第三轮 |
第四轮 |
第五轮 |
第六轮 |
第七轮 |
1-0 |
0-5 |
2-0 |
0-6 |
3-0 |
0-7 |
4-0 |
2-7 |
6-4 |
3-1 |
7-5 |
4-2 |
1-6 |
5-3 |
3-6 |
7-3 |
4-7 |
1-4 |
5-1 |
2-5 |
6-2 |
4-5 |
1-2 |
5-6 |
2-3 |
6-7 |
3-4 |
7-1 |
无论比赛队是单数还是双数,最后一轮时,必定是“0”或最大的一个代号在右上角,“1”在右下角。
根据参赛队的个数不同,“1”朝逆时针方向移动一个位置时,应按规定的间隔数移动(见表),“0”或最大代号数应先于“1”移动位置。
间隔移动
参赛队数 |
间隔数 |
4队以下 |
0 |
5~6队 |
1 |
7~8队 |
2 |
9~10队 |
3 |
11~12队 |
4 |
“1”进行间隔移动时,凡遇到“0”或最大代号数时应先越过,不作间隔计算。
一般国内比赛,各队以上届比赛所取得的名次数作为代号,如第1名为“1”,第2名“2”,依此类推。世界性比赛大都采用东道主代号为“1”,上届第1名为“2”,依此类推。有的比赛也采用抽签方法确定代号。
import java.util.Scanner;public class Test{ public static void main(String args[]){ int team_Num;//队伍的数量 int team_Arr[];//队伍数组 int team_temp[]; boolean empty=false;//是否有轮空 int jump;//调动幅度 int round;//比赛轮数 int flag;//标志,队伍的最大的,或者0,其他队伍在移动的时候,如果碰到他,将跳过 int tempNum,tempNum1;//队伍在迭代时候保存临时变量的东西 //--------------------初始化一些数据 Scanner cin = new Scanner(System.in); System.out.print("输入队伍的数量: "); team_Num = cin.nextInt(); if(team_Num%2 != 0)//队伍个数为奇数时 { empty = true; team_Num++; } round = team_Num-1; jump = ((team_Num+1)/2)-1; team_Arr = new int[team_Num]; team_temp = new int[team_Num]; for(int i = 0;i< team_Num;i++){ team_Arr[i] = i+1; } if(empty) { team_Arr[team_Num-1]=0; } flag = team_Num-1; //---------------------开始计算了-------------- for(int j = 0;j< round;j++) { System.out.println("第"+(j+1)+"轮:"); for(int m = 0;m< team_Num/2;m++) { System.out.println(team_Arr[m]+"----"+team_Arr[team_Num-m-1]); } for(int g = 0;g< team_Num;g++) { team_temp[g] = team_Arr[g]; } if(flag != 0 ) { tempNum = team_Arr[flag];//temp 一开始总是记录0队或者最大队伍 flag = 0;//flag 跳动 tempNum1 = team_Arr[flag]; team_Arr[flag] = tempNum; } else { tempNum =team_Arr[flag];//temp 一开始总是记录0队或者最大队伍 tempNum1 = team_Arr[team_Num-1]; flag = team_Num-1;//flag 跳动 team_Arr[flag]= team_temp[flag] = tempNum; team_Arr[0]=team_temp[0] = tempNum1; } for(int k = 0;k< team_Num-1;k++)//走动 { int t = k; if(t >= team_Num) t = t - team_Num; int z = t; for(int u = 0;u< jump;u++) { t++; if(t == team_Num) t = t - team_Num; if(t == flag) t++; if(t == team_Num) t = t-team_Num; } team_Arr[t] = team_temp[z];// } } }}
import java.util.Scanner;public class Test1{ public static void main(String[] args){ int n,m; Scanner cin = new Scanner(System.in); System.out.print("输入队伍的数量: "); n= cin.nextInt(); if(n%2==0) m=n; else m=n+1; int a=1,b=1,index=1,loop=0; for(int i=1; i<=(m-1)*(m/2); i++) { if(a>=m) a=1; if(index>m/2) index=1; if(index==1){ loop++; if(i==1){ b=m; }else{ b=a; } System.out.println("第"+loop+"轮");; if(((i-1)/(m/2))%2==0){ System.out.println(a+"--"+m); }else{ System.out.println(m+"--"+a); } }else if(index>1 && index<=m/2){ if(b>1) b--; else b=m-1; System.out.println(a+"--"+b); } index++; a++; } }}
程序运行结果:
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://haidsoft.com/124470.html