201409-2 画图

实现

#include <cstdio>

#define MAX_SIZE 0x70

int map[MAX_SIZE][MAX_SIZE];

int main() {
    int num_triangle;
    scanf("%d",&num_triangle);

    for (int i = 0;i < num_triangle;++i) {
        int x1, y1, x2, y2;
        scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
        
        for (int j = x1;j < x2;++j) {
            for (int k = y1;k < y2;++k) {
                map[j][k] = 1;
            }
        }
         
    }

    int res = 0;
    for (int i = 0;i < MAX_SIZE;++i) {
        for (int j = 0;j < MAX_SIZE;++j) {
            res += map[i][j];
        }
    }

    printf("%d\n",res);

}
posted @ 2020-08-26 11:06  amonqsq  阅读(41)  评论(0编辑  收藏  举报