CF12E.Start of the season
提高+/省选-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Before the start of the football season in Berland a strange magic ritual is held. The most experienced magicians have to find a magic matrix of the size n × n (n is even number). Gods will never allow to start the championship without it. Matrix should contain integers from 0 to n - 1, main diagonal should contain only zeroes and matrix should be symmetric. Moreover, all numbers in each row should be different. Magicians are very tired of the thinking process, so they ask you to write a program to find such matrix.
在贝尔兰足球赛季开始前,会举行一场奇特的魔法仪式。最有经验的魔法师需要找出一个大小为 n×n 的魔法矩阵(其中 n 为偶数)。若缺少该矩阵,众神将绝不允许锦标赛开始。该矩阵需满足以下条件:
- 矩阵中只包含 0 到 n−1 的整数;
- 主对角线上的所有元素均为 0;
- 矩阵为对称矩阵;
- 每一行中的所有数字互不相同。
魔法师们已厌倦了思考过程,因此请你编写一个程序来找出这样的矩阵。
输入格式
The first line contains one integer n (2 ≤ n ≤ 1000), n is even.
第一行包含一个整数 n(2≤n≤1000),且 n 为偶数。
输出格式
Output n lines with n numbers each — the required matrix. Separate numbers with spaces. If there are several solutions, output any.
输出 n 行,每行 n 个数字——即所要求的矩阵。数字之间用空格分隔。若存在多个解,输出任意一个即可。
输入输出样例
输入#1
2
输出#1
0 1 1 0
输入#2
4
输出#2
0 1 3 2 1 0 2 3 3 2 0 1 2 3 1 0
输入解题思路,AI测评打分。不知道怎么写?