結果

問題 No.883 ぬりえ
ユーザー stngstng
提出日時 2022-08-07 21:03:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 725 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 81,624 KB
実行使用メモリ 87,116 KB
最終ジャッジ日時 2023-10-17 15:41:35
合計ジャッジ時間 2,671 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,444 KB
testcase_01 AC 36 ms
53,444 KB
testcase_02 AC 34 ms
53,444 KB
testcase_03 AC 34 ms
53,444 KB
testcase_04 AC 34 ms
53,444 KB
testcase_05 AC 34 ms
53,444 KB
testcase_06 AC 33 ms
53,444 KB
testcase_07 AC 38 ms
53,444 KB
testcase_08 AC 34 ms
53,444 KB
testcase_09 AC 34 ms
53,444 KB
testcase_10 AC 35 ms
53,444 KB
testcase_11 AC 36 ms
53,444 KB
testcase_12 AC 35 ms
53,444 KB
testcase_13 AC 35 ms
53,444 KB
testcase_14 AC 41 ms
59,008 KB
testcase_15 AC 136 ms
87,116 KB
testcase_16 AC 81 ms
79,956 KB
testcase_17 AC 67 ms
77,536 KB
testcase_18 AC 40 ms
59,008 KB
testcase_19 AC 36 ms
53,444 KB
testcase_20 AC 35 ms
53,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int,input().split())
cdd = (n+(k-1))//k
f = False
if cdd < k:
    tmp = cdd
    while tmp**2 < n:
        tmp += 1
    m = tmp
    f = True
else:
    m = cdd
print(m)

ans = [[""]*m for i in range(m)]
if f == True:
    cnt = n
    for i in range(m):
        for j in range(m):
            if cnt > 0:
                cnt -= 1
                ans[i][j] = "#"
            else:
                ans[i][j] = "."
else:
    cnt = n
    for i in range(m):
        lm = k
        for j in range(m):
            if cnt > 0 and lm > 0:
                cnt -= 1
                lm -= 1
                ans[i][(j+i)%m] = "#"
            else:
                ans[i][(j+i)%m] = "."


for i in range(m):
    print(*ans[i],sep="")
0