본문 바로가기

전체 글

(224)
백준 14247 나무 자르기 https://www.acmicpc.net/problem/14247#include #include #include using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n, ans = 0; vector> tree; cin >> n; tree.resize(n); for (int i = 0; i > tree[i].second; } for (int i = 0; i > tree[i].first; } sort(tree.begin(), tree.end()); for (int i = 0; i 1. 문제나무 n개의 초기 ..
Event 처리 1. 개요구구모 프로젝트에서 FCM을 사용하여 댓글 작성시 알림이 게시글 작성자에게 전송되도록 하는 기능을 구현하게 되었다. 이를 위해 다음 게시글의 코드를 참고하였다.https://velog.io/@kjy0302014/FCM-%EB%8C%93%EA%B8%80-%EC%95%8C%EB%A6%BC-%EA%B5%AC%ED%98%84%ED%95%98%EA%B8%B0 FCM 댓글 알림 구현하기FCM은 메세지를 안정적으로 전송할 수 있는 크로스 플랫폼 메시징 솔류션 입니다. 그렇기 때문에 Android, iOS, Unity, Flutter, Web 다양한 곳에서 적용 가능합니다. 그래서 이번에 Android Application 댓글 알velog.io이를 참고하여 댓글 작성 시 알림을 주는 방법은 다음과 같았다.@..
백준 1946 신입 사원 https://www.acmicpc.net/problem/1946#include #include #include using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin >> t; for (int test = 0; test > arr; cin >> n; arr.resize(n); for (int i = 0; i > arr[i].first >> arr[i].second; } sort(arr.begin(), arr.end()); int temp = 0; int a..
백준 1092 배 https://www.acmicpc.net/problem/1092#include #include #include using namespace std;vector lim;vector box;int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, m; int ans = 0; cin >> n; lim.resize(n); for (int i = 0; i > lim[i]; } sort(lim.begin(), lim.end(), greater()); cin >> m; box.resize(m); for (int i = 0; i > box[i]; } s..
백준 2212 센서 https://www.acmicpc.net/problem/2212#include #include #include using namespace std;vector arr;vector dif;int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, k; int ans = 0; cin >> n >> k; arr.resize(n); dif.resize(n - 1); for (int i = 0; i > arr[i]; } sort(arr.begin(), arr.end()); for (int i = 0; i  1. 문제n개의 센서의 x좌표상의 위치와 집중국의 개수 k가..
백준 19598 최소 회의실 개수 https://www.acmicpc.net/problem/19598 #include #include #include #define INF 987654321using namespace std;priority_queue, vector>, greater>> pq;priority_queue, greater> res;int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; for (int i = 0; i > s >> e; pq.push(make_pair(s, e)); } res.push(pq.top().second); pq.pop(); while..
댓글 알림 구현(feat. sse) 1. 개요 댓글 알림을 구현해야 했다. 누군가가 댓글을 작성하면 해당 댓글의 게시글 작성자에게 push 알림을 보내는 기능을 구현하고자 한다. 이 프로젝트는 댓글과 부모 댓글에 대한 대댓글로만 구현했으므로 회의를 통해 게시글 작성자에게만 댓글 알림을 보내도록 요구사항을 잡았다. 2. SSE 구현 코드2-1. Entity@Entity@Getter@Builder@AllArgsConstructor@NoArgsConstructor(access = AccessLevel.PROTECTED)public class Notification { @Id @GeneratedValue @Column(name = "notification_id") private Long id; private String..
백준 5904 Moo 게임 https://www.acmicpc.net/problem/5904#include using namespace std;string st = "moo";void s(int n, int k, int len) { int nLen = len * 2 + k + 3; if (n len && n > N; s(N, 1, 3); return 0;}1. 문제길이가 무한대인 Moo 수열이 있다. 이는 다음과 같은 규칙을 따른다.s(0)=moos(k)=s(k-1)+moo...o(o가 k-2개)+s(k-1)n이 주어졌을 때, n번째 글자를 구하라.2. 풀이규칙 자체가 재귀적이므로 이를 사용하여 구현할 수 있다. 우선 해당 수열은 다음과 같이 주어져있다. 중간의 moo...o의 길이는 k-1이므로 s(k-1..