[BaekJoon] #33701 - 새천년관 [Java][C++]
[BaekJoon] #33701 - 새천년관 [Java][C++]
1. 아이디어
주어진 조건을 만족하는 이름을 출력하면 되는 문제로 건물 이름이 gwan으로 끝나야 하며 맨 앞 글자와 맨 뒤 글자가 같아야 해서 n으로 시작해야 한다. 중간에 k와 u를 적절히 넣으면 된다.
2. 복잡도
| 접근 | 시간 | 공간 |
|---|---|---|
| 풀이 | $O(1)$ | $O(1)$ |
3. 코드
풀이 [Java][C++]
1
2
3
4
5
public class Main {
public static void main(String[] args) {
System.out.println("nkugwan");
}
}
1
2
3
4
5
6
7
8
9
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout << "nkugwan";
}
This post is licensed under CC BY 4.0 by the author.