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
- 컴공과
- 스택
- 개발
- 코딩
- 오퍼레이팅시스템
- 구현
- 너비우선탐색
- bfs
- 백준
- coding
- Stack
- 정석
- 자료구조
- 정석학술정보관
- vector
- 문제풀이
- 컴퓨터공학과
- Operating System
- 북리뷰
- 코테
- 그래프
- 브루트포스
- 컴공
- 오에스
- 알고리즘
- c++
- cs
- DP
- OS
- Computer science
Archives
- Today
- Total
Little Jay
1783번 병든 나이트 본문
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
if (n == 1) {
cout << 1 << "\n";
}
else if (n == 2) {
cout << min(4, (m + 1) / 2) << "\n";
}
else {
if (m >= 7) {
cout << m - 2 << "\n";
}
else {
cout << min(4, m) << "\n";
}
}
return 0;
}'알고리즘 > BOJ' 카테고리의 다른 글
| [C++] 백준 4949번 균형잡힌 세상 (0) | 2021.08.03 |
|---|---|
| [C++] 백준 1181번 단어 정렬 (0) | 2021.08.02 |
| [C++] 백준 2875번 대회 or 인턴 (0) | 2021.08.02 |
| [C++] 백준 11047번 동전 0 (0) | 2021.08.02 |
| [C++] 백준 1874번 스택 수열 (0) | 2021.08.02 |
Comments