:: ADVANCE ::

86일차 1. ncpc_event 본문

Algorithm/일일알고리즘

86일차 1. ncpc_event

KSJ14 2014. 10. 2. 16:20
반응형

http://183.106.113.109/30stair/ncpc_event/ncpc_event.php?pname=ncpc_event

 

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
32
33
#include <iostream>
using namespace std;
 
int main(void)
{
    int n, total, hotel, week, temp, min = 999999;
    int pri[20], inwon[15];
 
    cin >> n >> total >> hotel >> week;
 
    for(int i = 0; i < hotel; i++)    {
        cin >> pri[i];
        for(int j = 0; j < week; j++)    {
            cin >> inwon[j];
            if(inwon[j] >= n)    {
                temp = n * pri[i];
                if(temp <= total)    {
                    if(min > temp)    {
                        min = temp;
                    }
                }
            }
        }
    }
    
    if(min >= 999999)    {
        cout << "stay home" << endl;
        return 0;
    }
    cout << min << endl;
 
    return 0;
}

 

처음에 무슨소린지 몰라서 헤맸었는데

재현이한테 설명듣고 바로 풀음

 

input 첫째 줄 마지막 week는 개수의 의미일 뿐 문제에 별 뜻은 없었다

호텔에서 묵을 수 있는 인원이 여행가려는 인원보다 많으면

그 호텔을 선택할 여지가 생기며

그 다음 비용을 계산하면 된다.

 

반응형

'Algorithm > 일일알고리즘' 카테고리의 다른 글

90일차 1. sprime  (0) 2014.10.08
91일차 1. eratosthenes  (0) 2014.10.07
85일차 1. ladder  (0) 2014.10.02
84일차 1. cryption  (0) 2014.09.30
83일차 1. cantoring  (0) 2014.09.30
Comments