标签:输出 rgs 计划 mat port 比赛 print import out
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s=new Scanner(System.in); int a[][]=new int[65][65]; int v[]=new int[65]; int n=s.nextInt(); //2的n次方 int len=(int) Math.pow(2,n); for(int i=1;i<=len-1;i++) { Arrays.fill(v,0); System.out.print("<"+i+">"); for (int j = 1; j <= len / 2; j++) { for (int k = 1; k <= len; k++) { if (v[k] == 1) continue; for (int h = 1; h <= len; h++) { if (h == k) continue; if (v[h] == 1) continue; if (a[h][k] == 0 && a[k][h] == 0) { System.out.print(k + "-" + h + " "); v[k] = 1; v[h] = 1; a[k][h] = 1; a[h][k] = 1; break; } } } } System.out.println(); } } }
标签:输出 rgs 计划 mat port 比赛 print import out
原文地址:https://www.cnblogs.com/shiaguang/p/12363082.html