結果
問題 |
No.1988 Divisor Tiling
|
ユーザー |
|
提出日時 | 2022-06-24 23:23:58 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 714 bytes |
コンパイル時間 | 113 ms |
コンパイル使用メモリ | 7,680 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-11-08 18:58:35 |
合計ジャッジ時間 | 6,849 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 WA * 13 |
コンパイルメッセージ
Main.rb:51: warning: ambiguous first argument; put parentheses or a space even after `-' operator Syntax OK
ソースコード
def lscan; gets.split.map(&:to_i); end n, h = lscan div = (1..(n-1)).filter{|x| n/x*x == n}.to_a if h == 1 puts div.map{|d| [d.to_s]*d*' '}.flatten*' ' exit end div.each do |w| h2 = 0 stk = 0 ok = true div.each do |x| if x/w*w != x stk += x if stk > w ok = false break end if stk == w h2 += 1 stk = 0 end next end h2 += x/w end next unless ok # p h2 if h2 == h stk = [] div.each do |x| if x/w*w != x stk += [x]*x if stk.size == w puts stk*' ' stk = [] end next end (x/w).times {puts [x]*w*' '} end exit end end p -1