結果

問題 No.232 めぐるはめぐる (2)
ユーザー finefine
提出日時 2016-03-11 00:27:43
言語 Ruby
(3.3.0)
結果
AC  
実行時間 182 ms / 1,000 ms
コード長 588 bytes
コンパイル時間 36 ms
コンパイル使用メモリ 11,356 KB
実行使用メモリ 15,368 KB
最終ジャッジ日時 2023-10-12 13:45:33
合計ジャッジ時間 3,931 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 182 ms
15,260 KB
testcase_01 AC 180 ms
15,352 KB
testcase_02 AC 176 ms
15,328 KB
testcase_03 AC 175 ms
15,236 KB
testcase_04 AC 78 ms
15,048 KB
testcase_05 AC 76 ms
15,268 KB
testcase_06 AC 77 ms
15,144 KB
testcase_07 AC 76 ms
15,120 KB
testcase_08 AC 147 ms
15,368 KB
testcase_09 AC 77 ms
15,148 KB
testcase_10 AC 77 ms
15,152 KB
testcase_11 AC 77 ms
15,136 KB
testcase_12 AC 78 ms
15,152 KB
testcase_13 AC 80 ms
15,124 KB
testcase_14 AC 76 ms
15,144 KB
testcase_15 AC 77 ms
15,128 KB
testcase_16 AC 77 ms
15,264 KB
testcase_17 AC 78 ms
15,292 KB
testcase_18 AC 79 ms
15,036 KB
testcase_19 AC 77 ms
15,100 KB
testcase_20 AC 77 ms
15,088 KB
testcase_21 AC 77 ms
15,128 KB
testcase_22 AC 79 ms
15,236 KB
testcase_23 AC 79 ms
15,088 KB
testcase_24 AC 80 ms
15,264 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

t,a,b = gets.split.map(&:to_i)
if a + b == 0 && t == 1
    puts "NO"
    exit
end
u,r = (t + a) / 2,(t + b) / 2
d,l = u - a,r - b
if d < 0 || l < 0
    puts "NO"
else
    puts "YES"
    t.times{|i|
        if u > 0
            print '^'
            u -= 1
        elsif d > 0
            print 'v'
            d -= 1
        else
            print ''
        end
        if t - i - 1 < l + r
            if r > 0
                print '>'
                r -= 1
            else
                print '<'
                l -= 1
            end
        end
        print "\n"
        }
end
0