結果

問題 No.232 めぐるはめぐる (2)
ユーザー ciel
提出日時 2015-06-27 01:24:50
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 508 bytes
コンパイル時間 34 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,544 KB
最終ジャッジ日時 2024-07-07 19:50:26
合計ジャッジ時間 3,494 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
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