CF909B Segments
题意翻译
题目描述
给你一个整数N。考虑坐标轴上所有可能的部分,在整数点上的端点,坐标在0到N之间,包括它们。 您希望在几个层中绘制这些片段,这样在每个层中这些片段就不会重叠(尽管它们可能会接触到端点)。不能将这些段移动到坐标轴上的另一个位置。 找出给定N必须使用的最低层数。
输入格式:
唯一的输入行包含一个整数N(1<=N<=100)。
输出格式:
输出一个整数为给定的N绘制片段所需的最低层数。 采纳:鲁罗啵天霸
题目描述
You are given an integer NN . Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and NN , inclusive; there will be
of them.
You want to draw these segments in several layers so that in each layer the segments don't overlap (they might touch at the endpoints though). You can not move the segments to a different location on the coordinate axis.
Find the minimal number of layers you have to use for the given NN .
输入输出格式
输入格式:
The only input line contains a single integer NN ( 1<=N<=1001<=N<=100 ).
输出格式:
Output a single integer - the minimal number of layers required to draw the segments for the given NN .
输入输出样例
说明
As an example, here are the segments and their optimal arrangement into layers for N=4N=4 .


#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n;
int ans[];
int main(){
cin>>n;
ans[]=;ans[]=;ans[]=;ans[]=;
for(int i=;i<=;i++)
ans[i]=*ans[i-]-*ans[i-]+ans[i-];
cout<<ans[n]<<endl;
}
CF909B Segments的更多相关文章
- [LeetCode] Number of Segments in a String 字符串中的分段数量
Count the number of segments in a string, where a segment is defined to be a contiguous sequence of ...
- Greenplum记录(一):主体结构、master、segments节点、interconnect、performance monitor
结构:Client--master host--interconnect--segment host 每个节点都是单独的PG数据库,要获得最佳的性能需要对每个节点进行独立优化. master上不包含任 ...
- Application package 'AndroidManifest.xml' must have a minimum of 2 segments.
看了源码就是packagename里面必须包含一个. 源码在: ./sdk/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/id ...
- segments&cache
Segments 执行效果 命令 在 sense 里边执行 GET /abcd/_segments 前边的是索引名称,后边是请求 段信息 说明 索引是面向分片的,是由于索引是由一个或多个分片( ...
- [UCSD白板题] Points and Segments
Problem Introduction The goal in this problem is given a set of segments on a line and a set of poin ...
- [UCSD白板题] Covering Segments by Points
Problem Introduction You are given a set of segments on a line and your goal is to mark as few point ...
- MAPPING SEGMENTS TO PAGES
The segmentation and paging mechanisms provide in the support a wide variety of approaches to memory ...
- Codeforces Round #337 (Div. 2) D. Vika and Segments 线段树 矩阵面积并
D. Vika and Segments Vika has an infinite sheet of squared paper. Initially all squares are whit ...
- Leetcode: Number of Segments in a String
Count the number of segments in a string, where a segment is defined to be a contiguous sequence of ...
随机推荐
- c15--二位数组
// // main.c // day08 #include <stdio.h> int main(int argc, const char * argv[]) { /* int scor ...
- Spark新愿景:让深度学习变得更加易于使用——见https://github.com/yahoo/TensorFlowOnSpark
Spark新愿景:让深度学习变得更加易于使用 转自:https://www.jianshu.com/p/07e8200b7cea 前言 Spark成功的实现了当年的承诺,让数据处理变得更容易,现在 ...
- 【POJ 3090】 Visible Lattice Points
[题目链接] http://poj.org/problem?id=3090 [算法] 通过观察发现,在这个平面直角坐标系中,除了(1,1),(1,0)和(0,1),所有可见点的横纵坐标互质 那么,问题 ...
- 整体刷新和局部刷新frameset窗口
在项目中,经常会遇到页面分割,最常见的系统或网站的主界面.主页面分为,上面系统简介.下面作者简介.左边系统功能菜单.右边则是菜单真正展示的界面. 遇到这种这种分割页面,大家首先想到是frameset, ...
- Docker installs
docker要求系统内核必须在3.10以上uname -r 命令查看你当前的内核版本 1.更新yum源并删除旧版docker yum remove docker docker-common docke ...
- 1.Ventuz 介绍
Ventoz能做什么? Ventuz是一款实时图文包装内容创作.制作和播出控制软件.Ventuz专注于高端视听内容的制作,包括交互展示和大型活动.视频墙.广播电视在线包装及演播室舞台及灯光控制等领域. ...
- Install opencv on Centos
研究centos 有很长一段时间了,一直没有写过这方面的感觉,今天在看到网友的一篇文章时,结合亲身体会就下面安装opencv的一些步骤与大家共享. CentOS OpenCV已被广泛应用但是也在不断的 ...
- Javassist介绍
要想将编译时不存在的类在运行时动态创建并加载,通常有两种策略: 1. 动态编译 2. 动态生成二进制字节码(.class) 对于第二种策略,实际上已经有诸多比较成熟的开源项目提供支持,如CGLib.A ...
- WebService 服务接口
天气预报Web服务,数据来源于中国气象局Endpoint :http://www.webxml.com.cn/WebServices/WeatherWebService.asmxDisco :http ...
- iphone通讯录的备份与恢复
最近在做iOS系统通讯录备份到服务器,并且可以从服务器中下载备份文件恢复到手机的功能,部分实现细节记录如下. 将iphone系统通讯录生成.vcf文件 ABAddressBookRef address ...