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
- 컴공과
- 스택
- 북리뷰
- 그래프
- 브루트포스
- 코테
- Stack
- vector
- 코딩
- 정석학술정보관
- OS
- 컴퓨터공학과
- 정석
- c++
- coding
- 너비우선탐색
- 문제풀이
- bfs
- Computer science
- 개발
- 자료구조
- 컴공
- 알고리즘
- 오에스
- cs
- 오퍼레이팅시스템
- Operating System
- 구현
- DP
- 백준
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