結果

問題 No.883 ぬりえ
ユーザー tcltktcltk
提出日時 2021-11-19 15:55:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 228 ms / 2,000 ms
コード長 1,219 bytes
コンパイル時間 1,125 ms
コンパイル使用メモリ 87,208 KB
実行使用メモリ 84,840 KB
最終ジャッジ日時 2023-08-29 23:32:29
合計ジャッジ時間 6,376 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 205 ms
80,952 KB
testcase_01 AC 197 ms
81,012 KB
testcase_02 AC 200 ms
80,836 KB
testcase_03 AC 197 ms
81,060 KB
testcase_04 AC 196 ms
81,092 KB
testcase_05 AC 198 ms
80,772 KB
testcase_06 AC 198 ms
81,048 KB
testcase_07 AC 200 ms
80,836 KB
testcase_08 AC 197 ms
80,808 KB
testcase_09 AC 196 ms
80,724 KB
testcase_10 AC 198 ms
80,916 KB
testcase_11 AC 196 ms
80,720 KB
testcase_12 AC 198 ms
80,848 KB
testcase_13 AC 201 ms
80,980 KB
testcase_14 AC 199 ms
81,004 KB
testcase_15 AC 228 ms
84,840 KB
testcase_16 AC 211 ms
84,160 KB
testcase_17 AC 206 ms
83,732 KB
testcase_18 AC 200 ms
81,116 KB
testcase_19 AC 205 ms
80,988 KB
testcase_20 AC 200 ms
81,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
import bisect
import heapq


def input():
    return sys.stdin.readline()[:-1]


# sys.setrecursionlimit(1000000)

# _INPUT = """13 3
# """
# sys.stdin = io.StringIO(_INPUT)

INF = 10**10


def solve(N, K):
    for M in range(1, INF):
        if M <= K:
            if N <= M*M:
                A = [['.'] * M for _ in range(M)]
                n = 0
                for i in range(M):
                    for j in range(M):
                        if n < N:
                            A[i][j] = '#'
                            n += 1
                return M, A
        else:
            if N <= K*M:
                A = [['.'] * M for _ in range(M)]
                n = 0
                j = 0
                for i in range(M):
                    for _ in range(K):
                        if n < N:
                            A[i][j] = '#'
                            j = (j + 1) % M
                            n += 1
                return M, A
    
    return None, None

N, K = map(int, input().split())
M, A = solve(N, K)

print(M)
for i in range(M):
    print(''.join(A[i]))
0