結果

問題 No.232 めぐるはめぐる (2)
ユーザー hanorverhanorver
提出日時 2015-10-08 09:29:07
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,164 bytes
コンパイル時間 375 ms
コンパイル使用メモリ 59,380 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-27 07:57:45
合計ジャッジ時間 3,894 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<algorithm>

int main() {
	int time, up, right;
	std::cin >> time >> up >> right;

	if (time < std::max(up, right) || (time == 1 && up == 0 && right == 0)) {
		std::cout << "NO" << std::endl;
		return 0;
	}
	std::cout << "YES" << std::endl;

	int min = std::min(up, right);
	up -= min;
	right -= min;
	time -= min;
	for (int i = 0; i < min; i++) {
		std::cout << "^>" << std::endl;
	}
	
	while (up >= 0 && time > 2) {
		std::cout << "^" << std::endl;
		up--;
		time--;
	}
	while (right >= 0 && time > 2) {
		std::cout << ">" << std::endl;
		right--;
		time--;
	}

	while(time > 2){
		std::cout << "<" << std::endl;
		std::cout << ">" << std::endl;
		time -= 2;
	}

	if (up == 0) {
		if(time == 1){
			std::cout << ">" << std::endl;
		} else {
			std::cout << ">^" << std::endl;
			std::cout << "v" << std::endl;
		}
	} else if (right == 0) {
		if (time == 1) {
			std::cout << "^" << std::endl;
		} else {
			std::cout << ">^" << std::endl;
			std::cout << "<" << std::endl;
		}
	}else{
		if(time == 2){
			std::cout << ">" << std::endl;
			std::cout << "^" << std::endl;
		} else {
			std::cout << "^>" << std::endl;
		}
	}
	return 0;
}
0