[原创]codeforces 710C Magic Odd Square 【杂类】
[原创]codeforces 710C Magic Odd Square 【杂类】
2016-08-23 21:02:49 Tabris_ 阅读数:367
博客爬取于2020-06-14 22:43:43
以下为正文
版权声明:本文为Tabris原创文章,未经博主允许不得私自转载。
https://blog.csdn.net/qq_33184171/article/details/52294422
题目链接 : http://codeforces.com/problemset/problem/710/C
-----------------------------------.
C. Magic Odd Square
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
Input
The only line contains odd integer n (1 ≤ n ≤ 49).
Output
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
Examples
input
1
output
1
input
3
output
2 1 4
3 5 7
6 9 8
-----------------------------------------.
题目大意: 就是给你一个奇 数N 让你把1~ N^2 填到N*N的 矩阵中 使得每行每列主对角线的和为奇数
解题思路:
附本题代码
---------------------------.
1 | # include<stdio.h> |