結果
問題 | No.401 数字の渦巻き |
ユーザー |
![]() |
提出日時 | 2019-05-20 04:48:45 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 31 ms / 2,000 ms |
コード長 | 659 bytes |
コンパイル時間 | 75 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-09-17 06:38:10 |
合計ジャッジ時間 | 1,894 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
def n_dire():dire = 0while True:yield diredire = (dire + 1) % 4N = int(input())nums = [[0 for x in range(N)] for y in range(N)]nd = n_dire()turn = Falsen = N ** 2c = 1x = -1y = 0step = Nwhile c <= n:dire = next(nd)for i in range(step):if dire % 2:if dire == 1:y+=1elif dire == 3:y-=1else:if dire == 0:x+=1elif dire == 2:x-=1nums[y][x] = cc+=1turn^=Trueif turn:step-=1for i in nums:print(" ".join(map(lambda x:format(x,"03d"),i)))