結果

問題 No.883 ぬりえ
ユーザー kawap23kawap23
提出日時 2019-09-13 21:59:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 592 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 10,872 KB
実行使用メモリ 16,472 KB
最終ジャッジ日時 2023-09-17 07:15:13
合計ジャッジ時間 2,648 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,992 KB
testcase_01 AC 16 ms
8,096 KB
testcase_02 AC 18 ms
7,956 KB
testcase_03 AC 17 ms
7,912 KB
testcase_04 AC 18 ms
8,040 KB
testcase_05 AC 17 ms
7,996 KB
testcase_06 AC 16 ms
8,056 KB
testcase_07 WA -
testcase_08 AC 16 ms
7,988 KB
testcase_09 WA -
testcase_10 AC 17 ms
7,988 KB
testcase_11 AC 17 ms
8,096 KB
testcase_12 AC 16 ms
8,124 KB
testcase_13 AC 17 ms
7,952 KB
testcase_14 AC 16 ms
8,004 KB
testcase_15 AC 483 ms
16,472 KB
testcase_16 AC 133 ms
10,604 KB
testcase_17 AC 68 ms
9,444 KB
testcase_18 AC 17 ms
7,920 KB
testcase_19 AC 17 ms
7,924 KB
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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