結果

問題 No.883 ぬりえ
ユーザー maimai
提出日時 2019-09-13 21:57:57
言語 Ruby
(3.2.2)
結果
WA  
実行時間 -
コード長 536 bytes
コンパイル時間 54 ms
コンパイル使用メモリ 11,608 KB
実行使用メモリ 17,188 KB
最終ジャッジ日時 2023-09-17 07:14:42
合計ジャッジ時間 3,463 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,284 KB
testcase_01 AC 80 ms
15,084 KB
testcase_02 AC 81 ms
15,216 KB
testcase_03 AC 80 ms
15,164 KB
testcase_04 AC 81 ms
15,148 KB
testcase_05 AC 80 ms
15,244 KB
testcase_06 AC 79 ms
15,148 KB
testcase_07 WA -
testcase_08 AC 80 ms
15,268 KB
testcase_09 WA -
testcase_10 AC 80 ms
15,280 KB
testcase_11 AC 81 ms
15,136 KB
testcase_12 AC 82 ms
15,212 KB
testcase_13 AC 80 ms
15,272 KB
testcase_14 AC 80 ms
15,316 KB
testcase_15 AC 86 ms
17,188 KB
testcase_16 AC 83 ms
15,812 KB
testcase_17 AC 85 ms
15,324 KB
testcase_18 AC 79 ms
15,352 KB
testcase_19 AC 79 ms
15,136 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 = [r, z].min
        b = z - a
        puts '.'*(k*(n/(k*k)))+'#'*a+'.'*b
        r -= z
    end
end
0