Kadj Squares - POJ 3347
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<algorithm>
using namespace std; const int MAXN = ;
const double EPS = 1e-; struct Line{int L, R, len;}a[MAXN]; int main()
{
int N; while(scanf("%d", &N) != EOF && N)
{
memset(a, , sizeof(a)); for(int i=; i<N; i++)
{
scanf("%d", &a[i].len);
for(int j=; j<i; j++)
a[i].L = max(a[i].L, a[j].R-abs(a[j].len-a[i].len));
a[i].R = a[i].L + a[i].len * ;
} for(int i=; i<N; i++)
{
for(int j=; j<i; j++)
{
if(a[i].L < a[j].R && a[i].len < a[j].len)
a[i].L = a[j].R;
}
for(int j=i+; j<N; j++)
{
if(a[i].R > a[j].L && a[i].len < a[j].len)
a[i].R = a[j].L;
}
} for(int k=, i=; i<N; i++)
{
if(a[i].L < a[i].R)
{
if(k++)printf(" ");
printf("%d", i+);
}
}
printf("\n");
} return ;
}
Kadj Squares - POJ 3347的更多相关文章
- POJ 3347 Kadj Squares
Kadj Squares Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 2132 Accepted: 843 Descr ...
- poj3347 Kadj Squares【计算几何】
Kadj Squares Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 3594 Accepted: 1456 Desc ...
- poj3347 Kadj Squares (计算几何)
D - Kadj Squares Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Su ...
- POJ 3347 Kadj Squares (计算几何)
题目: Description In this problem, you are given a sequence S1, S2, ..., Sn of squares of different si ...
- POJ 3347 Kadj Squares (计算几何+线段相交)
题意:从左至右给你n个正方形的边长,接着这些正方形都按照旋转45度以一角为底放置坐标轴上,最左边的正方形左端点抵住y轴,后面的正方形依次紧贴前面所有正方形放置,问从上方向下看去,有哪些正方形是可以被看 ...
- 简单几何(线段覆盖) POJ 3347 Kadj Squares
题目传送门 题意:告诉每个矩形的边长,它们是紧贴着的,问从上往下看,有几个还能看到. 分析:用网上猥琐的方法,将边长看成左端点到中心的距离,这样可以避免精度问题.然后先求出每个矩形的左右端点,然后如果 ...
- POJ 3347 Kadj Squares (线段覆盖)
题目大意:给你几个正方形的边长,正方一个顶点在x轴上然后边与x轴的夹角为45度,每个正方形都是紧贴的,问从上面看能看的正方形的编号 题目思路:线段覆盖,边长乘上2防止产生小数,求出每个正方形与x轴平行 ...
- POJ 3347 Kadj Squares 计算几何
求出正方形的左右端点,再判断是否覆盖 #include <iostream> #include <cstdio> #include <cstring> #inclu ...
- [poj] 3347 Kadj Square || 计算几何的“线段覆盖”
原题 多组数据,给出n个正方形的边长,使他们以45度角倾斜的情况下最靠左(在第一象限内),如图.求从上看能看到哪几个完整的正方形. 借鉴于https://www.cnblogs.com/Ritchie ...
随机推荐
- 比较ArrayList和LinkedList
比较一:添加内容 涉及方法:add public void add_test(){ List<Person> addlist = new ArrayList<Person>() ...
- POJ 1631 Bridging signals(LIS O(nlogn)算法)
Bridging signals Description 'Oh no, they've done it again', cries the chief designer at the Waferla ...
- postman本地或远程访问不了
问题postman: 问题描述: 1.手动测试过不去http://121.199.54.31:8081/suppliers/Split 2.localhost:8080/microshop-settl ...
- jQuery插件综合应用(二)文字为主的页面
一.介绍 文字内容是每个网站都有的内容,网站在展示文字内容时,总是比图片.视频等富媒体内容要难一些,因为富媒体容易被用户接受.尤其是越多的文字内容越难以被用户通篇的阅读,跳跃式阅读往往是阅读的主要方式 ...
- Bootstrap_排版_表格
一.基础表格 <table class="table"> <thead> <tr> <th>表格标题</th> < ...
- 把AS代码链接到fla文件
在属性里找到类,输入AS脚本的文件名然后点击右边的编辑就可以打开编辑AS脚本的界面,下面为链接代码. package { import flash.display.MovieClip; public ...
- bcov进行覆盖率统计
kcov是在bcov基础上进行的,bcov已经很久没有维护了: 首先需要下载依赖库libdwraft,然后在configure时候进行指定: ./configure --with-libdwarf=/ ...
- 关于微软RDLC报表打印时文字拉伸问题(Windows server 2003 sp2)
最近我们开发的打印服务频频出现打印文字拉伸问题,客户意见络绎不绝,最为明显的是使用黑体加粗后 “2.0份” 打印出来后小数点几乎看不见了,用户很容易误认为 “ 20份” .所以问题达到了不得不停下手上 ...
- POJ 2513 Colored Sticks 字典树、并查集、欧拉通路
Description You are given a bunch of wooden sticks. Each endpoint of each stick is colored with some ...
- POJ 2965 The Pilots Brothers' refrigerator 位运算枚举
The Pilots Brothers' refrigerator Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 151 ...