반응형
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 | #include <iostream> using namespace std; int main() { int N, M, K, i, j, x, y, sum; cin >> N >> M; int **arr = new int *[N]; for (int i = 0; i < N; i++) { arr[i] = new int[M]; } for (int i = 0; i < N; i++) { for (int j = 0; j < M; j++) { cin >> arr[i][j]; } } cin >> K; for (int a = 0; a < K; a++) { sum = 0; cin >> i >> j >> x >> y; for (int t = i-1; t < x; t++) { for (int o = j-1; o < y; o++) { sum += arr[t][o]; } } cout << sum << '\n'; } } | cs |
'Algorithm' 카테고리의 다른 글
C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 2566번:최댓값 답 (0) | 2016.11.16 |
---|---|
(C++) - 백준(BOJ) 13698 : Hawk eyes (0) | 2016.11.15 |
(C++) - 백준(BOJ) 2757번 : 세수정렬 답 (0) | 2016.11.15 |
C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 1157번:단어공부 답 (0) | 2016.11.13 |
C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 9095번:1,2,3 더하기 답 (0) | 2016.11.12 |