結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
7,964 KB
testcase_01 AC 18 ms
8,224 KB
testcase_02 AC 17 ms
8,268 KB
testcase_03 AC 16 ms
8,244 KB
testcase_04 AC 16 ms
8,340 KB
testcase_05 AC 16 ms
8,340 KB
testcase_06 AC 16 ms
8,368 KB
testcase_07 WA -
testcase_08 AC 17 ms
8,328 KB
testcase_09 WA -
testcase_10 AC 18 ms
8,216 KB
testcase_11 AC 18 ms
8,444 KB
testcase_12 AC 17 ms
8,308 KB
testcase_13 AC 16 ms
8,336 KB
testcase_14 AC 17 ms
8,276 KB
testcase_15 AC 484 ms
16,400 KB
testcase_16 AC 130 ms
10,472 KB
testcase_17 AC 68 ms
9,376 KB
testcase_18 AC 17 ms
8,348 KB
testcase_19 AC 17 ms
8,320 KB
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 = int(sqrt(N))
if n * n < N:
    n += 1

M = count * K + n
# print (count, N, 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