結果

問題 No.883 ぬりえ
ユーザー kawap23kawap23
提出日時 2019-09-14 10:43:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 310 ms / 2,000 ms
コード長 634 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 10,744 KB
実行使用メモリ 16,476 KB
最終ジャッジ日時 2023-09-19 05:18:16
合計ジャッジ時間 2,462 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,744 KB
testcase_01 AC 16 ms
7,780 KB
testcase_02 AC 17 ms
7,836 KB
testcase_03 AC 17 ms
7,748 KB
testcase_04 AC 17 ms
8,348 KB
testcase_05 AC 17 ms
8,256 KB
testcase_06 AC 17 ms
8,204 KB
testcase_07 AC 16 ms
7,792 KB
testcase_08 AC 16 ms
7,716 KB
testcase_09 AC 16 ms
7,920 KB
testcase_10 AC 17 ms
7,708 KB
testcase_11 AC 16 ms
7,884 KB
testcase_12 AC 16 ms
7,920 KB
testcase_13 AC 16 ms
7,756 KB
testcase_14 AC 17 ms
8,460 KB
testcase_15 AC 310 ms
16,476 KB
testcase_16 AC 89 ms
10,308 KB
testcase_17 AC 50 ms
9,344 KB
testcase_18 AC 17 ms
7,868 KB
testcase_19 AC 17 ms
8,424 KB
testcase_20 AC 16 ms
7,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
M = (N + (K - 1)) // K

if M < K:
    from math import sqrt
    n = int(sqrt(N))
    if n * n < N:
        n += 1
    M = n
    lst = [['.'] * M for _ in range(M)]
    for i in range(M):
        for j in range(M):
            if N > 0:
                lst[i][j] = '#'
                N -= 1
    print (M)
    for i in lst:
        print (*i, sep = '')
    exit()


lst = [['.'] * M for _ in range(M)]

for i in range(M):
    for j in range(K):
        if N > 0:
            lst[i][(i + j) % M] = '#'
            N -= 1
        else:
            break

print (M)
for i in lst:
    print (*i, sep = '')
0