题目链接:uva 1445 - Cubist Artwork
题目大意:给出一个不规则图形的正视图和左视图,问说最少使用多少个小立方体。、
解题思路:很容易想到,如果正视图和左视图有一列刚好高度相等,则可省去一列。
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
const int N = 50;
int n, m, d[N], h[N];
void init() {
int a;
memset(d, 0, sizeof(d));
memset(h, 0, sizeof(h));
for (int i = 0; i < n; i++) {
scanf("%d", &a);
d[a]