結果

問題 No.232 めぐるはめぐる (2)
ユーザー tentententen
提出日時 2021-03-18 09:30:22
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 1,122 bytes
コンパイル時間 2,080 ms
コンパイル使用メモリ 76,804 KB
実行使用メモリ 48,460 KB
最終ジャッジ日時 2024-04-27 22:50:10
合計ジャッジ時間 6,584 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 161 ms
48,460 KB
testcase_01 AC 157 ms
47,608 KB
testcase_02 AC 142 ms
47,260 KB
testcase_03 AC 152 ms
47,592 KB
testcase_04 AC 135 ms
41,400 KB
testcase_05 RE -
testcase_06 AC 105 ms
41,024 KB
testcase_07 AC 112 ms
41,200 KB
testcase_08 AC 145 ms
44,288 KB
testcase_09 AC 109 ms
41,188 KB
testcase_10 AC 105 ms
41,044 KB
testcase_11 AC 103 ms
41,080 KB
testcase_12 AC 96 ms
40,020 KB
testcase_13 RE -
testcase_14 AC 104 ms
40,956 KB
testcase_15 AC 108 ms
40,748 KB
testcase_16 AC 113 ms
41,116 KB
testcase_17 AC 103 ms
40,816 KB
testcase_18 AC 99 ms
40,584 KB
testcase_19 AC 105 ms
41,116 KB
testcase_20 RE -
testcase_21 AC 95 ms
39,932 KB
testcase_22 AC 101 ms
41,196 KB
testcase_23 AC 101 ms
41,008 KB
testcase_24 AC 107 ms
41,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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();
        if (t < a || t < b) {
            System.out.println("NO");
            return;
        }
        int[][] steps = new int[t][2];
        int start = 0;
        while (t - start > a + b) {
            steps[start][0] = 1;
            steps[start + 1][0] = -1;
            start += 2;
        }
        for (int i = 0; i < a; i++) {
            steps[start + i][0] = 1;
        }
        for (int i = 0; i < b; i++) {
            steps[t - 1 - i][1] = 1;
        }
        StringBuilder sb = new StringBuilder();
        sb.append("YES\n");
        for (int i = 0; i < t; i++) {
            if (steps[i][0] == 1) {
                sb.append("^");
            } else if (steps[i][0] == -1) {
                sb.append("v");
            }
            if (steps[i][1] == 1) {
                sb.append(">");
            }
            sb.append("\n");
        }
        System.out.print(sb);
    }
}
0