uva 105 - The Skyline Problem(暴力)
来源:互联网 发布:男士风衣 知乎 编辑:程序博客网 时间:2024/05/21 06:15
题目链接:uva 105 - The Skyline Problem
题目大意:给出若干栋房子的起始点,高度以及宽度,问说从正面看过去的轮廓中有哪些是高度转折点。
解题思路:因为h最大为1e5,最多有5000个房子,所以试着用一个数组记录每个位置的高度,然后遍历一次,结果给过了。。。。
#include <stdio.h>#include <string.h>#include <algorithm>using namespace std;const int N = 1e5+10;int l, h, r, v[N], R;int main () {R = 0;memset(v, 0, sizeof(v));while (scanf("%d%d%d", &l, &h, &r) == 3) {for (int i = l; i < r; i++)v[i] = max(v[i], h);R = max(r, R);}for (int i = 1; i < R; i++) {if (v[i] != v[i-1]) printf("%d %d ", i, v[i]);}printf("%d %d\n", R, 0);return 0;}
1 0
- uva 105 - The Skyline Problem(暴力)
- UVA 105 - The Skyline Problem(暴力枚举)
- UVa 105|The Skyline Problem|暴力|线段树
- UVA 105 - The Skyline Problem
- UVa 105 - The Skyline Problem
- UVA 105 - The Skyline Problem
- uva 105 The Skyline Problem
- Uva 105 The Skyline Problem
- UVa 105 The Skyline Problem (想法题)
- UVa OJ 105 - The Skyline Problem
- UVA 105 Skyline Problem
- UVa Problem 105 - Skyline Problem
- 105 - The Skyline Problem
- LeetCode 题解(96): The Skyline Problem
- LeetCode 218. The Skyline Problem(天际线)
- leetcode - The Skyline Problem
- The Skyline Problem
- The Skyline Problem
- poj3349 Snowflake Snow Snowflakes
- 程序员的奋斗史(三十四)——人在囧途之应聘篇(四)
- Delphi版本号对照
- art.dialog 与jquery ajax请求问题
- #pragma详解
- uva 105 - The Skyline Problem(暴力)
- [ jquery ] 关于jQuery中的自加载!
- OpenGL: 视图矩阵的推导
- 《美国骗局》奥斯卡提名的背后:云计算造就时空变换
- 数据库分页大全(oracle利用解析函数row_number高效分页)
- Linux启动报错UNEXPECTED INCONSISTENCY解决方法
- extern使用方法总结
- Map,HashMap,Hashtable,TreeMap总结
- matlab图像处理基础