結果

問題 No.232 めぐるはめぐる (2)
ユーザー kou6839kou6839
提出日時 2015-06-27 00:22:36
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,375 bytes
コンパイル時間 2,615 ms
コンパイル使用メモリ 74,900 KB
実行使用メモリ 512,768 KB
最終ジャッジ日時 2023-09-22 02:49:27
合計ジャッジ時間 9,931 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 167 ms
55,732 KB
testcase_01 AC 187 ms
57,980 KB
testcase_02 AC 170 ms
55,608 KB
testcase_03 WA -
testcase_04 AC 129 ms
55,528 KB
testcase_05 AC 128 ms
55,756 KB
testcase_06 AC 131 ms
55,536 KB
testcase_07 AC 130 ms
55,760 KB
testcase_08 WA -
testcase_09 AC 130 ms
55,732 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 132 ms
55,708 KB
testcase_13 AC 126 ms
55,760 KB
testcase_14 WA -
testcase_15 TLE -
testcase_16 AC 146 ms
53,520 KB
testcase_17 AC 130 ms
55,732 KB
testcase_18 AC 128 ms
55,732 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 127 ms
55,792 KB
testcase_22 AC 129 ms
55,764 KB
testcase_23 AC 128 ms
55,756 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public 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 need = Math.max(A, B);
		if(T < need ){
			System.out.println("NO");
			return;
		}
		if(T == need+1){
			if(A==0 || B==0){
				System.out.println("NO");
				return;
			}else{
				System.out.println("YES");
				StringBuilder sb = new StringBuilder();
				sb.append(">\n");
				sb.append("^\n");
				for(int i=0;i<Math.min(A, B)-1;i++) sb.append("^>\n");
				for(int i=0;i<A-1-Math.min(A, B);i++){
					sb.append("^\n");
				}
				for(int i=0;i<B-1-Math.min(A, B);i++){
					sb.append(">\n");
				}
				System.out.print(sb);
				return;
			}
		}
		StringBuilder sb = new StringBuilder();
		System.out.println("YES");
		for(int i=0;i<Math.min(A, B);i++){
			sb.append("^>\n");
		}
		int rest = T - B;
		if(rest==0) {
			System.out.print(sb);
			return;
		}
		if(A>B){
			for(int i=0;i<A-B;i++){
				sb.append("^\n");
			}
		}else{
			for(int i=0;i<B-A;i++){
				sb.append(">\n");
			}
		}
		while(true){
			if(rest == 2){
				sb.append(">\n");
				sb.append("<\n");
				break;
			}
			if(rest == 3){
				sb.append("^>\n");
				sb.append("<\n");
				sb.append("v\n");
				break;
			}
			sb.append(">\n");
			sb.append("<\n");
			rest-=2;
		}
		System.out.print(sb);
	}
}
0