6593 상범 빌딩
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102#include #include #include #include using namespace std; int level, row, col;int st_y, st_x, st_h;int end_y, end_x, end_h; int dh[6] = { 0,0,0,0,1 , -1};int dx[6] = { 1,-1,0,0,0 ,0};int dy[6] = { 0,0,..
2020. 3. 12.
2875 대회 or 인턴
123456789101112131415161718192021222324252627#include int main() { int n, m, k; scanf("%d %d %d", &n, &m, &k); int a, b, c; if (n >= 2 * m) { a = m; b = n - 2 * m; } else { a = n / 2; b = m - a; } if (b >= k) printf("%d", a); else { int c = k - b; if (c % 3 == 0) printf("%d", a - c / 3); else printf("%d", a - (c / 3 + 1)); }}Colored by Color Scriptercs 그리디 문제라고 분류되어있긴 한데,이게 왜 그리디인지 모르겠다 처음부터 끝까지..
2020. 3. 12.