paste bin
Author
Language
Python
Plain text
Accesslog
Action script
Ada
Apache
Arduino
Armasm
Autohotkey
Awk
Bash
Basic
Brainfuck
C
Clojure
Cmake
C++
C#
css
D
Delphi
Dockerfile
Erlang
Fortran
F#
Gauss
Go
Gradle
Graphql
Groovy
Haskell
Ini
Java
JavaScript
json
Julia
Kotlin
Lasso
LaTeX
Leaf
lisp
llvm
Lua
Makefile
Markdown
Mathematica
Matlab
Nginx
Objective-C
Ocaml
Oxygene
Perl
PgSQL
php
Powershell
Processing
Profile
Properties
Puppet
Purebasic
Q
QML
R
Ruby
Rust
Scala
Scheme
Scilab
Shell
Smalltalk
SQL
Swift
Typescript
VB.NET
VB Script
Verilog
Vim
Wasm
x86asm
Xml
Xquery
Yaml
source code:
def output(s): print(s,end="") N=int(input()) ORDER=2*N-1 matrix=[ [ 0 for _ in range(ORDER) ] for _ in range(ORDER) ] i=1 x=0 y=ORDER//2 while i<=ORDER**2: matrix[x][y]=i nextX=x-1 if nextX<0: nextX = ORDER-1 nextY=y+1 if nextY==ORDER: nextY = 0 if matrix[nextX][nextY] != 0: nextX=x+1 if nextX==ORDER: nextX=0 nextY=y x=nextX y=nextY i+=1 for it in matrix: firstChar=True for num in it: if firstChar: firstChar=False else: output(" ") output(num) print()
comment: