[BaekJoon] #5524 - 입실 관리 [Java][C++]
[BaekJoon] #5524 - 입실 관리 [Java][C++]
1. 아이디어
주어진 문자열을 소문자로 변환해서 출력만 하면 된다.
2. 복잡도
| 접근 | 시간 | 공간 |
|---|---|---|
| 풀이 | $O(N \times L)$ | $O(L)$ |
($N$ = 입력값 n, $L$ = s의 길이의 최댓값)
3. 코드
풀이 [Java][C++]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int n = Integer.parseInt(br.readLine());
while (n-- > 0) {
bw.write(br.readLine().toLowerCase());
bw.newLine();
}
bw.flush();
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
while (n--) {
string s;
cin >> s;
for (char c : s) {
cout << (char)tolower(c);
}
cout << '\n';
}
}
This post is licensed under CC BY 4.0 by the author.