結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
15,164 KB
testcase_01 WA -
testcase_02 AC 138 ms
15,320 KB
testcase_03 WA -
testcase_04 AC 87 ms
15,192 KB
testcase_05 AC 85 ms
15,132 KB
testcase_06 AC 85 ms
15,156 KB
testcase_07 AC 86 ms
15,216 KB
testcase_08 WA -
testcase_09 AC 86 ms
15,168 KB
testcase_10 AC 85 ms
15,204 KB
testcase_11 AC 86 ms
15,240 KB
testcase_12 AC 86 ms
15,148 KB
testcase_13 WA -
testcase_14 AC 83 ms
15,216 KB
testcase_15 AC 84 ms
15,072 KB
testcase_16 WA -
testcase_17 AC 85 ms
15,096 KB
testcase_18 AC 89 ms
15,004 KB
testcase_19 AC 85 ms
15,240 KB
testcase_20 AC 83 ms
15,216 KB
testcase_21 AC 82 ms
15,188 KB
testcase_22 AC 83 ms
15,216 KB
testcase_23 AC 83 ms
15,264 KB
testcase_24 AC 83 ms
15,288 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 and a==0 and b==0)
	puts :NO
else
	puts :YES
	if a==0
		if (b-t)%2>0
			output '^'
			output 'v>'
			b-=1
		end
	elsif b==0
		if (a-t)%2>0
			output '>'
			output '<^'
			a-=1
		end
	elsif (t-a-b)%2==0
		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