작성
·
211
0
다른 케이스에선 전부 success가 뜨는데 2에서만 틀린이유가 무엇일까요?ㅠ 강의에 나온 코드와 비교해 보아도 딱히 틀린게 없어보입니다.
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
int h,w,hh,hw,sum,max=-2147000000;
cin>>h>>w;
vector <vector <int> > tree (h, vector <int> (w));
for(int i =0; i<h; i++){
for(int j = 0; j<w; j++){
cin>>tree[i][j];
}
}
cin>>hh>>hw;
for(int i = 0; i<h-hh; i++){
for(int j = 0; j<w-hw; j++){
sum = 0;
for(int x = i; x<i+hh; x++){
for(int y = j; y<j+hw; y++){
sum+=tree[x][y];
}
}
if(max<sum){
max = sum;
}
}
}
cout<<max;
return 0;
}