Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | |||||
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
| 31 |
Tags
- js
- LeetCode
- 자료구조
- sql
- 코테
- 코딩테스트준비
- Sort
- python
- Algorithm
- til
- 위상정렬
- generic class
- DB
- 99클럽
- 가상컴퓨팅
- 정렬
- dbms
- 항해99
- 크루스칼
- mysql
- JPA
- jsp
- 알고리즘
- 코딩테스트
- 개발자취업
- spring
- javascript
- 공개키 암호화
- 99클럽 #코딩테스트준비 #개발자취업 #항해99 #til
- Java
Archives
- Today
- Total
PLOD
[백준] 세로읽기(10798) 본문
https://www.acmicpc.net/problem/10798
✅ 코드
package test;
import java.io.*;
import java.util.*;
public class 백준_10798 {
public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int max = 0;
char[][] arr = new char[5][15];
for(int i = 0; i < 5 ; i++){
String str = br.readLine();
if(str.length() > max){
max = str.length();
}
for(int j = 0; j < str.length(); j++){
arr[i][j] = str.charAt(j);
}
}
for(int i = 0; i < max ; i++){
for(int j = 0; j < 5 ; j++){
if(arr[j][i] == '\0'){
continue;
}
System.out.print(arr[j][i]);
}
}
}
}
// 14272 104
💡 배운 점 & 느낀 점
- str.charAt(j) → String 문자열에서 인덱스 j번째 출력
- arr[j][i] == '\0' →
char[][] arr = new char[5][15];
다음과 같이 초기화 했을 때, char 형태의 배열은 '\0'으로 초기화
'대외 활동 및 IT 지식 > 알고리즘 문제 풀이 정리' 카테고리의 다른 글
| [백준] 식당 메뉴(26043) (0) | 2026.02.25 |
|---|---|
| [백준] 큐(10843) (0) | 2026.02.22 |
| [백준] 스택(10828) (0) | 2026.02.22 |
| [백준] 그대로 출력하기 2(11719) (0) | 2026.02.14 |
| [프로그래머스] 문자열 내 p와 y의 개수 (0) | 2026.02.14 |
Comments