結果

問題 No.401 数字の渦巻き
ユーザー convexineqconvexineq
提出日時 2021-02-13 14:54:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 440 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 75,464 KB
最終ジャッジ日時 2023-09-27 23:22:38
合計ジャッジ時間 4,331 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,300 KB
testcase_01 AC 76 ms
71,324 KB
testcase_02 AC 75 ms
70,896 KB
testcase_03 AC 75 ms
71,100 KB
testcase_04 AC 76 ms
71,316 KB
testcase_05 AC 75 ms
71,244 KB
testcase_06 AC 73 ms
71,356 KB
testcase_07 AC 76 ms
71,244 KB
testcase_08 AC 75 ms
71,316 KB
testcase_09 AC 75 ms
71,104 KB
testcase_10 AC 77 ms
70,900 KB
testcase_11 AC 74 ms
71,384 KB
testcase_12 AC 75 ms
71,144 KB
testcase_13 AC 79 ms
71,280 KB
testcase_14 AC 78 ms
71,268 KB
testcase_15 AC 76 ms
71,340 KB
testcase_16 AC 76 ms
71,148 KB
testcase_17 AC 75 ms
71,188 KB
testcase_18 AC 75 ms
71,108 KB
testcase_19 AC 77 ms
71,256 KB
testcase_20 AC 77 ms
71,252 KB
testcase_21 AC 77 ms
71,104 KB
testcase_22 AC 75 ms
71,296 KB
testcase_23 AC 77 ms
71,272 KB
testcase_24 AC 78 ms
71,096 KB
testcase_25 AC 75 ms
71,280 KB
testcase_26 AC 75 ms
71,296 KB
testcase_27 AC 79 ms
71,392 KB
testcase_28 AC 113 ms
75,464 KB
testcase_29 AC 82 ms
75,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = [[n*n]*n for _ in range(n)]
v = 1
for r in range(n//2+1):
    R = n-r-1
    for i in range(r,R):
        a[r][i] = v
        v += 1
    for i in range(r,R):
        a[i][R] = v
        v += 1
    for i in range(r+1,R+1)[::-1]:
        a[R][i] = v
        v += 1
    for i in range(r+1,R+1)[::-1]:
        a[i][r] = v
        v += 1

def f(x):
    s = str(x)
    return "0"*(3-len(s))+s

for x in a:
    print(*map(f,x))
0