-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEventPlanning.cpp
More file actions
38 lines (34 loc) · 810 Bytes
/
EventPlanning.cpp
File metadata and controls
38 lines (34 loc) · 810 Bytes
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
34
35
36
37
38
#include <iostream>
using namespace std;
int main(){
int n,b,w,h;
int p,a;
bool valido;
int valor = 0, _valor;
while (!cin.eof())
{
valor = INT32_MAX;
cin >> n >> b >> h >> w;
for(int i = 0; i < h; i++){
cin >> p;
valido = false;
for (int j = 0; j < w; j++)
{
cin >> a;
valido = (a >= n) || valido;
}
if(valido){
_valor = n * p;
if(_valor < valor){
if(_valor <= b)
valor = _valor;
}
}
}
if (valor == INT32_MAX )
cout << "stay home" << endl;
else
cout << valor << endl;
}
return 0;
}