結果
問題 |
No.401 数字の渦巻き
|
ユーザー |
|
提出日時 | 2020-08-31 20:10:02 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 747 bytes |
コンパイル時間 | 340 ms |
コンパイル使用メモリ | 82,688 KB |
実行使用メモリ | 64,768 KB |
最終ジャッジ日時 | 2024-11-17 02:20:01 |
合計ジャッジ時間 | 2,799 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 29 RE * 1 |
ソースコード
N = int(input()) A = [['' for i in range(N)] for j in range(N)] i = 0 j = 0 k = 0 x = 1 while not A[i][j]: A[i][j] = str(x).zfill(3) x += 1 if k == 0: if j < N - 1 and not A[i][j + 1]: j += 1 else: i += 1 k = 1 elif k == 1: if i < N - 1 and not A[i + 1][j]: i += 1 else: j -= 1 k = 2 elif k == 2: if j > 0 and not A[i][j - 1]: j -= 1 else: i -= 1 k = 3 else: if i > 0 and not A[i - 1][j]: i -= 1 else: j += 1 k = 0 for a in A: print(*a)