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