結果

問題 No.883 ぬりえ
ユーザー Alex WiceAlex Wice
提出日時 2019-09-13 21:42:24
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 708 bytes
コンパイル時間 1,110 ms
コンパイル使用メモリ 77,308 KB
実行使用メモリ 78,976 KB
最終ジャッジ日時 2023-09-17 07:04:14
合計ジャッジ時間 4,029 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
76,200 KB
testcase_01 AC 74 ms
76,228 KB
testcase_02 AC 73 ms
76,268 KB
testcase_03 AC 72 ms
76,360 KB
testcase_04 AC 72 ms
76,368 KB
testcase_05 AC 72 ms
76,356 KB
testcase_06 AC 72 ms
76,136 KB
testcase_07 WA -
testcase_08 AC 72 ms
76,576 KB
testcase_09 WA -
testcase_10 AC 74 ms
76,452 KB
testcase_11 AC 73 ms
76,628 KB
testcase_12 AC 75 ms
76,356 KB
testcase_13 AC 74 ms
76,168 KB
testcase_14 AC 75 ms
76,372 KB
testcase_15 AC 130 ms
78,976 KB
testcase_16 AC 93 ms
78,624 KB
testcase_17 AC 88 ms
78,832 KB
testcase_18 AC 73 ms
76,388 KB
testcase_19 AC 74 ms
76,140 KB
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

rr = raw_input
rri = lambda: int(raw_input())
rrm = lambda: map(int, raw_input().split())

def make(N, K, tot):
    ans = [['.'] * N for _ in xrange(N)]
    for r, row in enumerate(ans):
        for c, v in enumerate(row):
            zr = r / K
            zc = c / K
            if zr == zc and tot:
                ans[r][c] = '#'
                tot -= 1
    return ans

def solve(tot, K):
    def carry(n):
        ans = 0
        while n > 0:
            delta = min(n, K)
            ans += delta * delta
            n -= delta
        return ans

    n = 1
    while carry(n) < tot:
        n += 1
    return make(n, K, tot)

ans = solve(*rrm())
print len(ans)
for row in ans:
    print "".join(row)
0