結果

問題 No.232 めぐるはめぐる (2)
ユーザー cielciel
提出日時 2015-06-27 01:24:50
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 508 bytes
コンパイル時間 66 ms
コンパイル使用メモリ 11,320 KB
実行使用メモリ 15,520 KB
最終ジャッジ日時 2023-09-22 03:02:25
合計ジャッジ時間 4,714 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 142 ms
15,288 KB
testcase_02 AC 141 ms
15,304 KB
testcase_03 AC 141 ms
15,296 KB
testcase_04 AC 85 ms
15,344 KB
testcase_05 AC 86 ms
15,128 KB
testcase_06 WA -
testcase_07 AC 88 ms
15,320 KB
testcase_08 AC 123 ms
15,508 KB
testcase_09 AC 84 ms
15,220 KB
testcase_10 AC 85 ms
15,132 KB
testcase_11 AC 86 ms
15,256 KB
testcase_12 AC 86 ms
15,284 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 84 ms
15,328 KB
testcase_16 AC 86 ms
15,132 KB
testcase_17 WA -
testcase_18 AC 88 ms
15,216 KB
testcase_19 AC 85 ms
15,364 KB
testcase_20 AC 84 ms
15,236 KB
testcase_21 AC 84 ms
15,364 KB
testcase_22 AC 85 ms
15,148 KB
testcase_23 AC 86 ms
15,164 KB
testcase_24 AC 86 ms
15,264 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

#!/usr/bin/ruby
$lineno=0
def output(s)
	puts s
	$lineno+=1
end
t,a,b=gets.split.map &:to_i
if [a,b].max>t || (t==1 && a==0 && b==0)
	puts :NO
else
	puts :YES
	if a==0 && (b-t)%2>0
		output '^'
		output 'v>'
		b-=1
	elsif b==0 && (a-t)%2>0
		output '>'
		output '<^'
		a-=1
	elsif (t-a-b)%2==0 && t>a+b
		output '>'
		output '^'
		a-=1
		b-=1
	end
	n=[a,b].min
	n.times{
		output '^>'
	}
	a-=n
	b-=n
	a.times{
		output '^'
	}
	b.times{
		output '>'
	}
	((t-$lineno)/2).times{
		output '^'
		output 'v'
	}
end
0