結果

問題 No.883 ぬりえ
ユーザー maimai
提出日時 2019-09-13 22:04:10
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 562 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 11,368 KB
実行使用メモリ 17,324 KB
最終ジャッジ日時 2023-09-17 14:23:02
合計ジャッジ時間 4,437 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,164 KB
testcase_01 AC 84 ms
15,272 KB
testcase_02 AC 83 ms
15,232 KB
testcase_03 AC 84 ms
15,132 KB
testcase_04 AC 83 ms
15,164 KB
testcase_05 AC 84 ms
15,016 KB
testcase_06 AC 85 ms
15,140 KB
testcase_07 WA -
testcase_08 AC 85 ms
15,248 KB
testcase_09 WA -
testcase_10 AC 84 ms
15,228 KB
testcase_11 AC 84 ms
15,124 KB
testcase_12 AC 85 ms
15,104 KB
testcase_13 AC 83 ms
15,332 KB
testcase_14 AC 83 ms
15,156 KB
testcase_15 AC 89 ms
17,324 KB
testcase_16 AC 86 ms
15,988 KB
testcase_17 AC 86 ms
15,396 KB
testcase_18 AC 83 ms
15,136 KB
testcase_19 AC 85 ms
15,220 KB
testcase_20 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:14: 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

abort if n == 0

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