結果

問題 No.1133 キムワイプイーター
ユーザー face4face4
提出日時 2020-08-02 14:45:03
言語 Java21
(openjdk 21)
結果
AC  
実行時間 594 ms / 2,000 ms
コード長 1,161 bytes
コンパイル時間 1,997 ms
コンパイル使用メモリ 73,448 KB
実行使用メモリ 61,412 KB
最終ジャッジ日時 2023-09-25 17:10:49
合計ジャッジ時間 15,502 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
54,120 KB
testcase_01 AC 120 ms
55,584 KB
testcase_02 AC 391 ms
59,908 KB
testcase_03 AC 563 ms
58,844 KB
testcase_04 AC 525 ms
60,580 KB
testcase_05 AC 594 ms
60,936 KB
testcase_06 AC 492 ms
60,628 KB
testcase_07 AC 499 ms
61,128 KB
testcase_08 AC 551 ms
61,412 KB
testcase_09 AC 423 ms
60,232 KB
testcase_10 AC 438 ms
60,608 KB
testcase_11 AC 472 ms
60,680 KB
testcase_12 AC 548 ms
60,952 KB
testcase_13 AC 472 ms
60,832 KB
testcase_14 AC 255 ms
58,884 KB
testcase_15 AC 362 ms
59,112 KB
testcase_16 AC 466 ms
60,528 KB
testcase_17 AC 320 ms
59,712 KB
testcase_18 AC 420 ms
59,708 KB
testcase_19 AC 314 ms
59,688 KB
testcase_20 AC 378 ms
59,500 KB
testcase_21 AC 433 ms
59,544 KB
testcase_22 AC 420 ms
57,864 KB
testcase_23 AC 122 ms
56,052 KB
testcase_24 AC 123 ms
56,208 KB
testcase_25 AC 312 ms
60,004 KB
testcase_26 AC 124 ms
55,888 KB
testcase_27 AC 124 ms
56,000 KB
testcase_28 AC 125 ms
56,168 KB
testcase_29 AC 123 ms
55,928 KB
testcase_30 AC 421 ms
59,716 KB
testcase_31 AC 124 ms
56,356 KB
testcase_32 AC 121 ms
55,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        String s = sc.next();
        int arr[][] = new int[n+1][n+1];
        for(int i = 0; i < n+1; i++){
            for(int j = 0; j < n+1; j++){
                arr[i][j] = 1;
            }
        }
        arr[0][0] = 0;
        int i = 0, j = 0;
        for(int x = 0; x < m; x++){
            switch(s.charAt(x)){
                case 'R':
                    j++;
                    break;
                case 'L':
                    j--;
                    break;
                case 'U':
                    i++;
                    break;
                case 'D':
                    i--;
                    break;
            }
            arr[i][j] = 0;
        }
        for(int k = n; k >= 0; k--){
            for(int l = 0; l <= n; l++){
                if(l > 0)   System.out.print(" ");
                System.out.print(arr[k][l]);
            }
            System.out.println();
        }
    }
}
0