문제링크
https://www.acmicpc.net/problem/20114
package BOJ;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main_20114 {
static int N,H,W;
static char ch[];
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
N = Integer.parseInt(st.nextToken()); //문자열의 길이
H = Integer.parseInt(st.nextToken()); //가로로 번진 개수
W = Integer.parseInt(st.nextToken()); //세로로 번진 개수
ch = new char[N];
Arrays.fill(ch,'?');
for(int i=0;i<H;i++){
String str = br.readLine();
for(int j=0;j<N*W;j++){
char c = str.charAt(j);
//System.out.println(c);
if(c == '?') continue;
else{
ch[j/W] = c;
}
}
}
for(int i=0;i<N;i++){
System.out.print(ch[i]);
}
}
}
'알고리즘 > 백준' 카테고리의 다른 글
[JAVA]백준_20053_최소,최대2 (0) | 2021.06.23 |
---|---|
[JAVA]백준_9421_소수상근수 (0) | 2021.06.23 |
[JAVA]백준_5567_결혼식 (0) | 2021.06.17 |
[JAVA]백준_8972_미친 아두이노 (0) | 2021.06.08 |
[JAVA]백준_6118_숨바꼭질 (0) | 2021.06.01 |