結果

問題 No.232 めぐるはめぐる (2)
ユーザー nCk_cvnCk_cv
提出日時 2015-08-03 02:23:45
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,439 bytes
コンパイル時間 2,087 ms
コンパイル使用メモリ 74,532 KB
実行使用メモリ 68,548 KB
最終ジャッジ日時 2023-09-25 00:41:31
合計ジャッジ時間 10,917 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 566 ms
68,548 KB
testcase_02 AC 635 ms
64,640 KB
testcase_03 AC 557 ms
68,424 KB
testcase_04 AC 176 ms
60,500 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 155 ms
58,632 KB
testcase_08 AC 498 ms
68,208 KB
testcase_09 AC 161 ms
58,468 KB
testcase_10 AC 130 ms
55,684 KB
testcase_11 WA -
testcase_12 AC 125 ms
56,144 KB
testcase_13 WA -
testcase_14 AC 122 ms
55,900 KB
testcase_15 AC 122 ms
53,404 KB
testcase_16 AC 123 ms
55,792 KB
testcase_17 AC 125 ms
55,500 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 126 ms
55,868 KB
testcase_22 AC 123 ms
55,740 KB
testcase_23 AC 125 ms
57,540 KB
testcase_24 AC 128 ms
55,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		int nowa = 0;
		int nowb = 0;
		
		
		int i;
		ArrayList<String> list = new ArrayList<String>();
		
		for(i = 0; i < t-1; i++) {
			if(nowa == a-1 && nowb == b-1) break;
			if(nowa == a && nowb == b) break;
			StringBuilder sb = new StringBuilder();
			if(nowa < a-1) {
				nowa++;
				sb.append("^");
			}
			if(nowb < b-1) {
				nowb++;
				sb.append(">");
			}
			list.add(sb.toString());
		}
		if((nowa != a-1 && nowa != a) || (nowb != b-1 && nowb != b) ) {
			System.out.println("NO");
			return;
		}
		System.out.println("YES");
		for(int j = 0; j < list.size(); j++) {
			System.out.println(list.get(j));
		}
		if(i == t-1) {
			StringBuilder sb = new StringBuilder();
			if(nowa < a) {
				nowa++;
				sb.append("^");
			}
			if(nowb < b) {
				nowb++;
				sb.append(">");
			}
			System.out.println(sb.toString());
			return;
		}
		i++;
		nowa++;
		if(nowa == a && nowb == b) {
			System.out.println("<");
		}
		else {
			System.out.println("^");
		}
		
		
		
		for(; i < t-1; i++) {
			if(nowa == a) {
				System.out.println("v>");
				nowa = a-1;
			}
			else {
				System.out.println("^<");
				nowa = a;
			}
		}
		if(nowa == a) {
			System.out.println(">");
		}
		else {
			System.out.println("^");
		}
		
		
		
		
		
		
		
		
		
	}
}
0