STEP: 5 とても大きな数値の入力
問題
解答
step5.java
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String line = sc.nextLine();
System.out.println(line);
}
}
結果
STEP: 6 とても小さな数値の入力
問題
解答
step6.java
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String line = sc.nextLine();
System.out.println(line);
}
}
結果
FINAL問題 文字列の配列
問題
解答
final.java
import java.util.*;
public class Main {
private static final String YES = "Yes";
private static final String NO = "No";
private static final String WALL = "#";
private static final String ROAD = ".";
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int h = sc.nextInt();
int w = sc.nextInt();
int r = sc.nextInt() -1;
int c = sc.nextInt() -1;
// 改行
sc.nextLine();
String[][] map = new String[h][w];
for(int i = 0; i < h; i++){
String line = sc.nextLine();
String[] array = line.split("");
map[i] = array;
}
if(Objects.equals(map[r][c], WALL)) {
System.out.println(YES);
} else {
System.out.println(NO);
}
}
}