結果

問題 No.232 めぐるはめぐる (2)
ユーザー tentententen
提出日時 2021-03-18 09:24:08
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,094 bytes
コンパイル時間 2,537 ms
コンパイル使用メモリ 77,972 KB
実行使用メモリ 60,412 KB
最終ジャッジ日時 2024-04-27 22:41:04
合計ジャッジ時間 9,406 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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();
        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