結果

問題 No.232 めぐるはめぐる (2)
ユーザー nbkwonnbkwon
提出日時 2015-09-26 00:53:24
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,504 bytes
コンパイル時間 467 ms
コンパイル使用メモリ 58,876 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-26 15:28:39
合計ジャッジ時間 4,303 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>


using namespace std;


int main()
{
	int t;
	int x;
	int y;
	cin >> t >> x >> y;
	if (t < x || t < y)
	{
		cout << "NO";
		return 0;
	}
	if (1)
	{
		cout << "YES" << endl;
		for (int i = 0; i < t - 2; i++)//두단계 전까지 간다
		{
			if (x > 0)
			{
				x--;
				cout << ">";//한칸가줬다

			}
			else//x가 0
			{
				x++;
				cout << "<";
			}
			if (y > 0)
			{
				y--;
				cout << "^";//한칸가줬다

			}
			else//x가 0
			{
				y++;
				cout << "v";
			}
			//일단 전진
			cout << endl;
		}
		//4가지 케이스가 있음. -1 0

		if (x == 1 && y == 1)
		{
			cout << ">" << endl;
			cout << "^" << endl;
			return 0;
		}
		if (x == 0 && y == 1)
		{
			cout << "<" << endl;
			cout << ">^" << endl;
			return 0;
		}
		if (x == 1 && y == 0)
		{
			cout << ">^" << endl;
			cout << "v" << endl;
			return 0;
		}
		if (x == 0 && y == 0)
		{
			cout << "<^" << endl;
			cout << ">v" << endl;
			return 0;
		}
		if (x > 0)
		{
			x--;
			cout << ">";//한칸가줬다

		}
		else//x가 0
		{
			x++;
			cout << "<";
		}
		if (y > 0)
		{
			y--;
			cout << "^";//한칸가줬다

		}
		else//x가 0
		{
			y++;
			cout << "v";
		}//t는 1
		cout << endl;
		if (x > 0)
		{
			x--;
			cout << ">";//한칸가줬다

		}
		else//x가 0
		{
			x++;
			cout << "<";
		}
		if (y > 0)
		{
			y--;
			cout << "^";//한칸가줬다

		}
		else//x가 0
		{
			y++;
			cout << "v";
		}//t는 1
		cout << endl;
	}

}
0