結果

問題 No.232 めぐるはめぐる (2)
ユーザー maimai
提出日時 2016-01-23 12:39:38
言語 Ruby
(3.3.0)
結果
AC  
実行時間 131 ms / 1,000 ms
コード長 815 bytes
コンパイル時間 39 ms
コンパイル使用メモリ 11,380 KB
実行使用メモリ 15,368 KB
最終ジャッジ日時 2023-10-12 13:44:07
合計ジャッジ時間 3,704 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
15,368 KB
testcase_01 AC 128 ms
15,204 KB
testcase_02 AC 121 ms
15,232 KB
testcase_03 AC 131 ms
15,308 KB
testcase_04 AC 78 ms
15,276 KB
testcase_05 AC 79 ms
15,124 KB
testcase_06 AC 78 ms
15,144 KB
testcase_07 AC 79 ms
15,296 KB
testcase_08 AC 113 ms
15,344 KB
testcase_09 AC 78 ms
15,108 KB
testcase_10 AC 79 ms
15,084 KB
testcase_11 AC 78 ms
15,224 KB
testcase_12 AC 81 ms
15,344 KB
testcase_13 AC 80 ms
15,016 KB
testcase_14 AC 78 ms
15,280 KB
testcase_15 AC 79 ms
15,244 KB
testcase_16 AC 79 ms
15,104 KB
testcase_17 AC 78 ms
15,224 KB
testcase_18 AC 80 ms
15,240 KB
testcase_19 AC 79 ms
15,116 KB
testcase_20 AC 80 ms
15,104 KB
testcase_21 AC 79 ms
15,320 KB
testcase_22 AC 79 ms
15,132 KB
testcase_23 AC 78 ms
15,128 KB
testcase_24 AC 78 ms
15,260 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

t,a,b=gets.split(" ").map(&:to_i)
min = a > b ? a : b
if t < min
    puts "NO"
    exit
end
if min==0
    if t<=1
        puts "NO"
    else
        puts "YES"
        while t > 0
            if t == 3
                puts "^>"
                puts "v"
                puts "<"
                exit
            end
            t-=2
            puts ">"
            puts "<"
        end
    end
    exit
end
puts "YES"
while t > min+1
    t-=2
    puts ">"
    puts "<"
end
if t > min
    t-=2
    if a!=0 && b!=0
        a-=1;b-=1
        puts ">"
        puts "^"
    else
        puts "^>"
        puts "<" if b==0
        puts "v" if a==0
    end
end
while t > 0
    t-=1
    if a!=0 && b!=0
        puts "^>"
    else
        puts "^" if b==0
        puts ">" if a==0
    end
    a-=1 if a>0
    b-=1 if b>0
end
0