結果

問題 No.883 ぬりえ
ユーザー maimai
提出日時 2019-09-13 21:59:59
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 545 bytes
コンパイル時間 111 ms
コンパイル使用メモリ 11,336 KB
実行使用メモリ 17,392 KB
最終ジャッジ日時 2023-09-17 07:15:22
合計ジャッジ時間 3,318 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,284 KB
testcase_01 AC 80 ms
15,084 KB
testcase_02 AC 80 ms
15,280 KB
testcase_03 AC 80 ms
15,296 KB
testcase_04 AC 79 ms
15,088 KB
testcase_05 AC 80 ms
15,132 KB
testcase_06 AC 78 ms
15,176 KB
testcase_07 WA -
testcase_08 AC 79 ms
15,216 KB
testcase_09 WA -
testcase_10 AC 77 ms
15,260 KB
testcase_11 AC 80 ms
15,332 KB
testcase_12 AC 79 ms
15,112 KB
testcase_13 AC 78 ms
15,084 KB
testcase_14 AC 78 ms
15,184 KB
testcase_15 AC 85 ms
17,392 KB
testcase_16 AC 81 ms
15,848 KB
testcase_17 AC 80 ms
15,392 KB
testcase_18 AC 79 ms
15,328 KB
testcase_19 AC 78 ms
15,288 KB
testcase_20 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:12: warning: assigned but unused variable - rn
Syntax OK

ソースコード

diff #

def lscan; gets.split.map(&:to_i); end

def fsqrt(x)
    Math.sqrt(x).to_i
end
def csqrt(x)
    Math.sqrt(x).ceil.to_i
end

n,k = lscan

rn = fsqrt(n)

if true
    c = n/(k*k)
    h = c*k
    rem = n - c*(k*k)
    h += csqrt(rem)
    p h
    m = n
    (n/(k*k)).times do |i|
        k.times do
            puts '.'*(k*i)+'#'*k+'.'*(h-(k*i+k))
        end
        m -= k*k
    end
    r = rem
    z = csqrt(rem)
    z.times do
        a = [0, [r, z].min].max
        b = z - a
        puts '.'*(k*(n/(k*k)))+'#'*a+'.'*b
        r -= z
    end
end
0