結果

問題 No.232 めぐるはめぐる (2)
ユーザー femtofemto
提出日時 2015-12-20 23:50:44
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 962 bytes
コンパイル時間 585 ms
コンパイル使用メモリ 61,120 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-17 14:39:15
合計ジャッジ時間 4,790 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 126 ms
4,348 KB
testcase_02 AC 125 ms
4,348 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,348 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,348 KB
testcase_10 WA -
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 WA -
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main() {
	int t, a, b;
	cin >> t >> a >> b;

	if(t < max(a, b) || a == 0 && b == 0 && t == 1) {
		cout << "NO" << endl;
		return 0;
	}

	cout << "YES" << endl;
	int x = 0, y = 0;
	while(max(a - x, b - y) > 1) {
		if(a - x != 0) {
			x++;
			cout << ">";
		}
		if(b - y != 0) {
			y++;
			cout << "^";
		}
		t--;
		cout << endl;
	}

	if(a - x + b - x == 2) {
		if(t % 2 == 0) {
			cout << "^" << endl;
			cout << ">" << endl;
			t -= 2;
		}
		else {
			cout << "^>" << endl;
			t--;
		}
	}
	else if(a - x == 0) {
		if(t % 2 == 0) {
			cout << "^" << endl;
			cout << ">v" << endl;
			t -= 2;
		}
		else {
			cout << ">" << endl;
			t--;
		}
	}
	else {
		if(t % 2 == 0) {
			cout << ">" << endl;
			cout << "^<" << endl;
			t -= 2;
		}
		else {
			cout << "^" << endl;
			t--;
		}
	}
	while(t > 0) {
		cout << ">" << endl;
		cout << "<" << endl;
		t -= 2;
	}
}
0