結果

問題 No.1133 キムワイプイーター
ユーザー xRS43BofaUEZ5gcxRS43BofaUEZ5gc
提出日時 2021-03-19 14:08:51
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,011 ms / 2,000 ms
コード長 957 bytes
コンパイル時間 3,472 ms
コンパイル使用メモリ 77,868 KB
実行使用メモリ 106,772 KB
最終ジャッジ日時 2024-04-29 07:20:08
合計ジャッジ時間 23,263 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
41,200 KB
testcase_01 AC 131 ms
41,284 KB
testcase_02 AC 640 ms
61,056 KB
testcase_03 AC 932 ms
92,992 KB
testcase_04 AC 926 ms
92,900 KB
testcase_05 AC 949 ms
92,720 KB
testcase_06 AC 889 ms
92,776 KB
testcase_07 AC 792 ms
77,756 KB
testcase_08 AC 757 ms
60,864 KB
testcase_09 AC 815 ms
93,400 KB
testcase_10 AC 953 ms
104,076 KB
testcase_11 AC 1,011 ms
106,712 KB
testcase_12 AC 951 ms
92,800 KB
testcase_13 AC 988 ms
106,772 KB
testcase_14 AC 669 ms
91,776 KB
testcase_15 AC 672 ms
71,012 KB
testcase_16 AC 704 ms
60,648 KB
testcase_17 AC 340 ms
44,288 KB
testcase_18 AC 454 ms
44,508 KB
testcase_19 AC 329 ms
43,768 KB
testcase_20 AC 442 ms
44,540 KB
testcase_21 AC 459 ms
44,752 KB
testcase_22 AC 458 ms
44,676 KB
testcase_23 AC 135 ms
41,308 KB
testcase_24 AC 123 ms
40,376 KB
testcase_25 AC 326 ms
43,664 KB
testcase_26 AC 132 ms
41,264 KB
testcase_27 AC 132 ms
41,264 KB
testcase_28 AC 138 ms
41,324 KB
testcase_29 AC 133 ms
41,196 KB
testcase_30 AC 456 ms
44,568 KB
testcase_31 AC 135 ms
41,328 KB
testcase_32 AC 133 ms
41,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class HelloWorld {
		public static void main (String[] args) {
			Scanner sc = new Scanner(System.in);
			int n = sc.nextInt();
			int m =sc.nextInt();
			sc.nextLine();
			String[] strs = sc.nextLine().split("");
			sc.close();

			int[][] matrix = new int[n+1][n+1];
			int[] position_now = {n,0};
			matrix[position_now[0]][position_now[1]] = -1;
			for (int i = 0; i < m; i ++) {

				if (strs[i].equals("R")) {
					position_now[1]++;
				}
				if (strs[i].equals("U")) {
					position_now[0]--;
				}
				if (strs[i].equals("L")) {
					position_now[1]--;
				}
				if (strs[i].equals("D")) {
					position_now[0]++;
				}
				matrix[position_now[0]][position_now[1]] = -1;
			}


			for (int i = 0; i < n+1; i ++) {
				for (int j = 0; j < n + 1; j ++) {
					System.out.print(matrix[i][j]==-1? "0":"1");
					if (j == n) {
						break;
					}
					System.out.print(" ");
				}
				System.out.println();
			}


	}
}
0