結果

問題 No.883 ぬりえ
ユーザー kawap23kawap23
提出日時 2019-09-13 23:01:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 669 bytes
コンパイル時間 456 ms
コンパイル使用メモリ 10,604 KB
実行使用メモリ 16,496 KB
最終ジャッジ日時 2023-09-17 15:07:44
合計ジャッジ時間 2,826 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
7,972 KB
testcase_01 AC 16 ms
8,012 KB
testcase_02 AC 17 ms
7,952 KB
testcase_03 AC 16 ms
7,972 KB
testcase_04 AC 17 ms
7,820 KB
testcase_05 AC 16 ms
7,884 KB
testcase_06 AC 17 ms
7,932 KB
testcase_07 WA -
testcase_08 AC 17 ms
8,040 KB
testcase_09 WA -
testcase_10 AC 16 ms
7,932 KB
testcase_11 AC 17 ms
7,976 KB
testcase_12 AC 16 ms
7,936 KB
testcase_13 AC 16 ms
7,936 KB
testcase_14 AC 18 ms
7,880 KB
testcase_15 AC 485 ms
16,496 KB
testcase_16 AC 132 ms
10,372 KB
testcase_17 AC 67 ms
9,336 KB
testcase_18 AC 17 ms
8,032 KB
testcase_19 AC 17 ms
7,872 KB
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

if K > N:
    print (error)
    
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 and count * K + K > i and count * K + K > j:
            lst[i][j] = '#'
            N -= 1
        else:
            break

#出力
print (M)
for i in lst:
    print (*i, sep = '')

0