@@ -0,0 +1,968 @@
+int n, m;%0Aint s%5B310%5D%5B310%5D;%0Amap%3Cint, int%3E h;%0A%0Ainline int get_sum(int x, int y, int i) %7B%0A    return s%5By%5D%5Bi%5D - s%5Bx%5D%5Bi%5D;%0A%7D%0Aint solve(int x, int y, int t) %7B%0A    int ret = 0;%0A    h.clear();%0A    h%5B0%5D = 1;%0A    for(int i = 1; i %3C= m; ++i) %7B%0A        int tmp = get_sum(x, y, i);%0A        auto iter = h.find(tmp - t);%0A        if(iter != h.end()) %7B%0A            ret += iter-%3Esecond;%0A        %7D%0A        h%5Btmp%5D++;%0A    %7D%0A    return ret;%0A    %0A%7D%0Aclass Solution %7B%0Apublic:%0A    int numSubmatrixSumTarget(vector%3Cvector%3Cint%3E%3E& matrix, int target) %7B%0A        n = matrix.size();%0A        m = matrix%5B0%5D.size();%0A        %0A        for(int i = 0; i %3C n; ++i) %7B%0A            for(int j = 0; j %3C m; ++j) %7B%0A                s%5Bi+1%5D%5Bj+1%5D = s%5Bi+1%5D%5Bj%5D + s%5Bi%5D%5Bj+1%5D - s%5Bi%5D%5Bj%5D + matrix%5Bi%5D%5Bj%5D;%0A            %7D%0A        %7D%0A        int ans = 0;%0A        for(int i = 0; i %3C n; ++i) %7B%0A            for(int j = i+1; j %3C= n; ++j) %7B%0A                ans += solve(i, j, target);%0A            %7D%0A        %7D%0A        return ans;%0A    %7D%0A%7D;%0A

Create lc1074.java