結果
問題 | No.401 数字の渦巻き |
ユーザー |
![]() |
提出日時 | 2019-08-15 11:01:45 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 30 ms / 2,000 ms |
コード長 | 344 bytes |
コンパイル時間 | 120 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-09-19 15:04:32 |
合計ジャッジ時間 | 1,965 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
N=int(input()) field=[[None]*N for i in [0]*N] y,x=0,0 std=0 d={0:(0,1),1:(1,0),2:(0,-1),3:(-1,0)} for i in range(1,N**2+1): field[y][x]="{0:03d}".format(i) y+=d[std][0] x+=d[std][1] ny=y+d[std][0] nx=x+d[std][1] if not (0<=ny<N and 0<=nx<N and field[ny][nx] is None): std=(std+1)%4 for l in field: print(*l)