Closed SongGwanSeok closed 4 months ago
Grumpy Bookstore Owner
int cur = 0;
for(int i = 0; i < grumpy.size(); i++){
if(grumpy[i] == 0){
cur += customers[i];
}
}
for(int i = 0; i < minutes; i++){
if(grumpy[i] == 1) {
cur += customers[i];
}
}
int _max = cur;
int p1 = 0;
int p2 = minutes;
while(p2 < grumpy.size()){
if(grumpy[p1] == 1){
cur -= customers[p1];
}
if(grumpy[p2] == 1){
cur += customers[p2];
}
p1++, p2++;
_max = max(_max, cur);
}
return _max;
📝 Description
무엇을?
왜?
❗️Todo
ETC
기타사항