Division algorithm-Round Robin schedule

Source: Internet
Author: User


Package divideconquer; public class scheduleroundrobin {/* There will n team competition, you must design * a schedule to fill the bill * 1. every team must play with other n-1 Team * 2.a team only take part in a competition * 3.If N is odd, the whole day of competion is n-1; * otherwise, the day is n *** // This is only applicable to the K-power individuals of 2 to participate in the competition, the odd public static void divide (INT data [] [], int N) {If (n = 1) {data [1] [1] = 1; return;} divide (data, n/2); conquer (data, n );} public static void conquer (INT data [] [], int N) {int M = n/2; for (INT I = 1; I <= m; I ++) {for (Int J = 1; j <= m; j ++) {data [I] [J + M] = data [I] [J] + m; data [I + M] [J] = data [I] [J + M]; data [I + M] [J + M] = data [I] [J] ;}} public static void main (string ARGs []) {int n = 14; int data [] [] = new int [n + 1] [n + 1]; divide (data, n + 1); For (INT I = 1; I <n + 1; I ++) {for (Int J = 1; j <n + 1; j ++) system. out. print (data [I] [J] + ""); system. out. println ();}}}

Reprinted: http://blog.sina.com.cn/s/blog_5a16b28c0100efjh.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.