結果

問題 No.401 数字の渦巻き
ユーザー LfSYEy1US1RWVNdLfSYEy1US1RWVNd
提出日時 2019-07-04 12:22:08
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,109 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 12,120 KB
実行使用メモリ 10,344 KB
最終ジャッジ日時 2023-10-19 07:35:08
合計ジャッジ時間 2,078 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

def issyuu(start,nagasa,syokiiti,gyouretu):
#(一周分の動き)start:はじめの値、nagasa:直進の長さ、syokiiti:座標(0,0)で0,(1,1)で1
	for i in range(nagasa):#右方向
		gyouretu[syokiiti][syokiiti + i] = start
		start += 1
	for i in range(nagasa - 1):#下方向
		gyouretu[syokiiti + i + 1][syokiiti + nagasa - 1] = start
		start += 1
	for i in range(nagasa - 1):#左方向
		gyouretu[syokiiti + nagasa - 1][syokiiti + nagasa - 2 - i] = start
		start += 1
	for i in range(nagasa - 2):#上方向
		gyouretu[syokiiti + nagasa - 2 - i][syokiiti] = start
		start += 1
	return gyouretu
N = int(input())
na = N
gy = [[1 for i in range(na)] for j in range(na)]
st = 1
sy = 0
for j in range((N+1)//2):
	issyuu(st,na,sy,gy)
	#以下、二週めの準備
	print(st,na,sy)
	st += 4*na - 4
	na = na - 2
	sy += 1
	print(st,na,sy)
#作成した行列を表示する
for k in range(N):
	for l in range(N):
		if len(str(gy[k][l]))==1:
			gy[k][l] = "00"+str(gy[k][l])
		elif len(str(gy[k][l]))==2:
			gy[k][l] = "0"+str(gy[k][l])
		else:
			gy[k][l] = str(gy[k][l])
		print(gy[k][l],end=" ")
	print()
print()
0