UVA 105 - The Skyline Problem
来源:互联网 发布:刘慧芳 知乎 编辑:程序博客网 时间:2024/05/17 22:52
只需要记录每一个关键点就行了,用数组存下来,如果两个相邻点的高度不同,则是一个关键点
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
using namespace std;
int a[10010];
int main()
{
int left,right,height,minleft=10000,maxright=0;
while(cin>>left>>height>>right)
{
for(int i=left; i!=right; i++)
if(a[i]<height)
a[i]=height;
if(left<minleft)
minleft=left;
if(right>maxright)
maxright=right;
}
for(int i=minleft; i!=maxright; i++)
if(a[i]!=a[i-1])
cout<<i<<\" \"<<a[i]<<\" \
- 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
- UVa 105|The Skyline Problem|暴力|线段树
- leetcode - The Skyline Problem
- The Skyline Problem
- The Skyline Problem
- The Skyline Problem
- LeetCode - The Skyline Problem
- UVA 106 - Fermat vs. Pythagoras
- UVA 11054 - Wine trading in Gergovia
- 10912 - Simple Minded Hashing
- [转]C++的cin/cout高阶格式化操作
- UVA - 103 Stacking Boxes
- UVA 105 - The Skyline Problem
- UVA 10617 - Again Palindrome
- UVA 10929 - You can say 11
- UVA 484 - The Department of Redundancy Department
- 10699 - Count the factors
- Codeforces Round #108 (Div. 2)
- UVA 567 - Risk
- UVA 417 - Word Index
- UVA 10397 - Connect the Campus