using System; using System.Collections.Generic; using System.Text; using System.Linq; class Program { public void Proc() { Reader.IsDebug = false; int len = int.Parse(Reader.ReadLine()); int[,] ans; if(len % 2 == 1) { ans = this.CreateMahoujinKisu(len); } else if(len % 4 == 0) { ans = this.CreateMahoujin4(len); } else { ans = this.CreateMahoujin4_2(len); } for(int i=0; i> list = new List>(); int[,] ans = new int[len, len]; for(int i=0; i()); list.Add(new List()); for(int j=0; j 0) { int convY = len + ((i+1) * -1); int convX = len + ((j+1) * -1); map1[convY, convX] = map2[i,j]; } } } return map1; } public int[,] CreateMahoujinKisu(int len) { int posY = 0; int posX = len / 2; int[,] ans = new int[len, len]; for(int i=1; i<=len * len; i++) { ans[posY, posX] = i; int newPosY = posY - 1; int newPosX = posX + 1; if(newPosY < 0) { newPosY = len - 1; } if(newPosX >= len) { newPosX = 0; } if(ans[newPosY, newPosX] > 0) { posY++; if(posY >= len) { posY = 0; } } else { posY = newPosY; posX = newPosX; } } return ans; } public class Reader { public static bool IsDebug = true; private static String PlainInput = @" 6 "; private static System.IO.StringReader Sr = null; public static string ReadLine() { if (IsDebug) { if (Sr == null) { Sr = new System.IO.StringReader(PlainInput.Trim()); } return Sr.ReadLine(); } else { return Console.ReadLine(); } } public static int[] GetInt(char delimiter = ' ', bool trim = false) { string inptStr = ReadLine(); if (trim) { inptStr = inptStr.Trim(); } string[] inpt = inptStr.Split(delimiter); int[] ret = new int[inpt.Length]; for (int i = 0; i < inpt.Length; i++) { ret[i] = int.Parse(inpt[i]); } return ret; } } static void Main() { Program prg = new Program(); prg.Proc(); } }