結果

問題 No.401 数字の渦巻き
ユーザー rocoderrocoder
提出日時 2017-08-11 02:32:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 667 bytes
コンパイル時間 73 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-20 20:55:03
合計ジャッジ時間 1,664 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 WA -
testcase_02 AC 27 ms
10,752 KB
testcase_03 WA -
testcase_04 AC 27 ms
10,624 KB
testcase_05 WA -
testcase_06 AC 26 ms
10,624 KB
testcase_07 WA -
testcase_08 AC 26 ms
10,624 KB
testcase_09 WA -
testcase_10 AC 28 ms
10,624 KB
testcase_11 WA -
testcase_12 AC 27 ms
10,752 KB
testcase_13 WA -
testcase_14 AC 27 ms
10,752 KB
testcase_15 WA -
testcase_16 AC 28 ms
10,880 KB
testcase_17 WA -
testcase_18 AC 26 ms
10,880 KB
testcase_19 WA -
testcase_20 AC 26 ms
10,752 KB
testcase_21 WA -
testcase_22 AC 26 ms
10,880 KB
testcase_23 WA -
testcase_24 AC 27 ms
10,880 KB
testcase_25 WA -
testcase_26 AC 27 ms
10,880 KB
testcase_27 WA -
testcase_28 AC 28 ms
10,752 KB
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#roll
N=int(input())
M=[]
for i in range(N):
    M.append([])
    for j in range(N):
        M[i].append(0)
k=1
N2=N-1
N2//=2
for i in range(N2):
    i2=2*i
    for j in range(N-1-i2):
        M[i][i+j]=k
        k+=1
    for j in range(N-1-i2):
        M[i+j][N-1-i]=k
        k+=1
    for j in range(N-1-i2):
        M[N-1-i][N-1-i-j]=k
        k+=1
    for j in range(N-1-i2):
        M[N-1-i-j][i]=k
        k+=1
M[N2][N2]=k
for i in range(N):
    for j in range(N):
        if M[i][j]<10:
            M[i][j]="00"+str(M[i][j])
        elif M[i][j]<100:
            M[i][j]="0"+str(M[i][j])
        else:
            M[i][j]=str(M[i][j])
    print(" ".join(M[i]))
0