結果

問題 No.883 ぬりえ
ユーザー kawap23kawap23
提出日時 2019-09-13 21:38:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 836 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 10,908 KB
実行使用メモリ 16,544 KB
最終ジャッジ日時 2023-09-17 07:01:13
合計ジャッジ時間 3,108 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,992 KB
testcase_01 AC 16 ms
7,972 KB
testcase_02 AC 16 ms
8,368 KB
testcase_03 AC 16 ms
8,000 KB
testcase_04 AC 16 ms
8,384 KB
testcase_05 AC 16 ms
8,364 KB
testcase_06 AC 16 ms
8,236 KB
testcase_07 WA -
testcase_08 AC 16 ms
8,048 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 16 ms
8,072 KB
testcase_12 AC 16 ms
7,988 KB
testcase_13 WA -
testcase_14 AC 16 ms
8,252 KB
testcase_15 AC 484 ms
16,544 KB
testcase_16 AC 130 ms
10,512 KB
testcase_17 AC 66 ms
9,396 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt
N, K = map(int, input().split())

if N <= K:
    M = int(sqrt(N))
    if M * M < N:
        M += 1
    print (M)
    for i in range(M):
        for j in range(M):
            if N > 0:
                print ('#', end = '')
                N -= 1
            else:
                print ('.', end= '')
        print()
    exit()


count = N // (K * K)
N -= count * K * K #残り塗らないといけない枚数
n = (N + (K - 1)) // K

M = count * K + n
lst = [['.'] * M for _ in range(M)]
for i in range(count * K):
    for j in range(count * K):
        if i // K == j // K:
            lst[i][j] = '#'

for i in range(count * K, M):
    for j in range(count * K, M):
        if n > 0:
            lst[i][j] = '#'
            n -= 1
        else:
            break
print (M)
for i in lst:
    print (*i, sep = '')
0