結果
| 問題 |
No.1133 キムワイプイーター
|
| ユーザー |
xRS43BofaUEZ5gc
|
| 提出日時 | 2021-03-19 14:08:51 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 956 ms / 2,000 ms |
| コード長 | 957 bytes |
| コンパイル時間 | 3,468 ms |
| コンパイル使用メモリ | 78,024 KB |
| 実行使用メモリ | 106,776 KB |
| 最終ジャッジ日時 | 2024-11-18 08:40:35 |
| 合計ジャッジ時間 | 22,464 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 31 |
ソースコード
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();
}
}
}
xRS43BofaUEZ5gc