結果

問題 No.232 めぐるはめぐる (2)
ユーザー fal_rndfal_rnd
提出日時 2016-10-29 23:06:49
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 841 bytes
コンパイル時間 2,353 ms
コンパイル使用メモリ 77,880 KB
実行使用メモリ 61,576 KB
最終ジャッジ日時 2024-05-03 19:41:36
合計ジャッジ時間 12,555 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 744 ms
48,100 KB
testcase_01 AC 897 ms
48,068 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 129 ms
41,436 KB
testcase_05 AC 130 ms
41,236 KB
testcase_06 AC 127 ms
41,112 KB
testcase_07 AC 128 ms
41,200 KB
testcase_08 WA -
testcase_09 AC 130 ms
41,100 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 130 ms
41,204 KB
testcase_13 AC 133 ms
40,932 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 131 ms
41,108 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 132 ms
41,248 KB
testcase_22 AC 132 ms
41,252 KB
testcase_23 AC 128 ms
41,372 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
class A{
	static Scanner s = new Scanner(System.in);
	public static void main(String[] args) {
		int m=s.nextInt(),tx=s.nextInt(),ty=s.nextInt(),x=0,y=0;
		if((tx>m||ty>m)||(tx==0&&ty==0&&m==1)) {
			System.out.println("NO");
			return;
		}
		System.out.println("YES");
		for(int i=0; i<m; i++) {
			if((i==m-2)&&(x==tx||y==ty)) {
				if(x==tx) {
					System.out.print('<');
					--x;
				}else {
					System.out.print('v');
					--y;
				}
			}else {
				if(x==tx&&y==ty) {
					System.out.print('<');
					--x;
				}else {
					if(x<tx) {
						System.out.print('>');
						x++;
					}else if (x>tx) {
						System.out.print('<');
						--x;
					}
					if(y<ty) {
						System.out.print('^');
						y++;
					}else if (y>ty) {
						System.out.print('v');
						--y;
					}
				}
			}
			System.out.println();
		}
	}
}
0