結果
問題 | No.1988 Divisor Tiling |
ユーザー |
|
提出日時 | 2022-06-24 23:31:41 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 112 ms / 2,000 ms |
コード長 | 757 bytes |
コンパイル時間 | 407 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 13,056 KB |
最終ジャッジ日時 | 2024-11-08 19:02:48 |
合計ジャッジ時間 | 5,053 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 32 |
コンパイルメッセージ
Main.rb:51: warning: ambiguous first argument; put parentheses or a space even after `-' operator Syntax OK
ソースコード
def lscan; gets.split.map(&:to_i); endn, h = lscandiv = (1..(n-1)).filter{|x| n/x*x == n}.to_add = div + [n]dd.each do |w|h2 = 0stk = 0ok = truediv.each do |x|if x/w*w != xstk += xif stk > w# p [w, stk]ok = falsebreakendif stk == wh2 += 1stk = 0endnextendh2 += x/wendnext unless ok# p h2if h2 == h || w == hmat = []stk = []div.each do |x|if x/w*w != xstk += [x]*xif stk.size == wmat << stkstk = []endnextend(x/w).times {mat << [x]*w}endmat = mat.transpose if w == hputs mat.map{|l| l*' '}exitendendp -1