본문 바로가기
알고리즘/그리디 알고리즘

4796 캠핑

by tryotto 2019. 2. 19.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
 
int upper[100= { 0 };
int down[100= { 0 };
 
int main() {    
    int idx = 1;
    while (1) {
        int n, a, b;
        scanf("%d %d %d"&n, &a, &b);
        if (n == 0return 0;
 
        int rst=0;
        if ((b%a) > n) {
            rst = (b / a)*+ n;
        }else{
            rst = (b / a)*+ (b%a);
        }
        printf("Case %d: %d\n", idx,rst);
        idx++;
    }    
}
cs


'알고리즘 > 그리디 알고리즘' 카테고리의 다른 글

mixing milk 더블릿  (0) 2019.02.20
(복습필요) 11000 강의실 배정  (0) 2019.02.19
1931 회의실 배정  (0) 2019.02.19
11047 동전만들기  (0) 2019.02.19
1449 수리공 항승  (0) 2019.02.19