結果
| 問題 |
No.401 数字の渦巻き
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-08-28 00:19:00 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 850 bytes |
| コンパイル時間 | 79 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-07-05 21:17:05 |
| 合計ジャッジ時間 | 1,943 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 30 |
ソースコード
N = int(input())
l = [[0] * N for i in range(N)]
d = 0
print(l)
x = 0
y = 0
for i in range(1, N**2 + 1):
if d % 4 == 0:
l[x][y] = str(i).zfill(3)
y += 1
if y >= N or l[x][y] != 0:
d += 1
y -= 1
x += 1
elif d % 4 == 1:
l[x][y] = str(i).zfill(3)
x += 1
if x >= N or l[x][y] != 0:
d += 1
x -= 1
y -= 1
elif d % 4 == 2:
l[x][y] = str(i).zfill(3)
y -= 1
if y < 0 or l[x][y] != 0:
d += 1
y += 1
x -= 1
elif d % 4 == 3:
l[x][y] = str(i).zfill(3)
x -= 1
if l[x][y] != 0:
d += 1
x += 1
y += 1
ans = ""
for i in l:
ans = ""
for j in i:
ans += j
ans += " "
print(ans[:-1])