結果

問題 No.1988 Divisor Tiling
ユーザー 👑 H20H20
提出日時 2022-06-24 23:25:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 623 bytes
コンパイル時間 221 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 71,040 KB
最終ジャッジ日時 2024-04-26 06:07:25
合計ジャッジ時間 3,024 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,480 KB
testcase_01 AC 36 ms
52,096 KB
testcase_02 AC 36 ms
51,840 KB
testcase_03 AC 37 ms
52,352 KB
testcase_04 AC 36 ms
51,968 KB
testcase_05 AC 36 ms
51,840 KB
testcase_06 AC 36 ms
52,352 KB
testcase_07 AC 37 ms
52,224 KB
testcase_08 AC 38 ms
53,120 KB
testcase_09 AC 39 ms
52,736 KB
testcase_10 AC 38 ms
53,248 KB
testcase_11 AC 37 ms
52,992 KB
testcase_12 AC 37 ms
52,864 KB
testcase_13 AC 38 ms
52,736 KB
testcase_14 AC 38 ms
52,864 KB
testcase_15 AC 39 ms
52,992 KB
testcase_16 AC 38 ms
53,376 KB
testcase_17 AC 39 ms
52,864 KB
testcase_18 AC 50 ms
62,592 KB
testcase_19 AC 46 ms
62,720 KB
testcase_20 AC 44 ms
61,952 KB
testcase_21 AC 46 ms
62,336 KB
testcase_22 AC 45 ms
62,592 KB
testcase_23 AC 46 ms
63,104 KB
testcase_24 AC 47 ms
62,976 KB
testcase_25 AC 45 ms
63,232 KB
testcase_26 AC 48 ms
64,000 KB
testcase_27 AC 53 ms
66,048 KB
testcase_28 AC 56 ms
67,712 KB
testcase_29 AC 59 ms
71,040 KB
testcase_30 AC 56 ms
70,656 KB
testcase_31 AC 49 ms
65,536 KB
testcase_32 AC 36 ms
52,224 KB
testcase_33 AC 36 ms
51,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i and i!=1:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

N,H = map(int, input().split())
D = make_divisors(N)
L = []
for d in D:
    L.extend([d]*d)
if H**2<N:
    for i in range(H):
        print(*L[i*(N//H):(i+1)*(N//H)])
else:
    LL = []
    for i in range(N//H):
        LL.append(L[i*H:(i+1)*H])
    T_S = list(zip(*LL))
    for x in T_S[::-1]:
        print(*x,sep=' ')
0