题意翻译

题目描述

给你一个整数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 .

输入输出样例

输入样例#1: 复制

2
输出样例#1: 复制

2
输入样例#2: 复制

3
输出样例#2: 复制

4
输入样例#3: 复制

4
输出样例#3: 复制

6

说明

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的更多相关文章

  1. [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 ...

  2. Greenplum记录(一):主体结构、master、segments节点、interconnect、performance monitor

    结构:Client--master host--interconnect--segment host 每个节点都是单独的PG数据库,要获得最佳的性能需要对每个节点进行独立优化. master上不包含任 ...

  3. Application package 'AndroidManifest.xml' must have a minimum of 2 segments.

    看了源码就是packagename里面必须包含一个. 源码在: ./sdk/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/id ...

  4. segments&cache

    Segments 执行效果 命令  在 sense 里边执行  GET /abcd/_segments  前边的是索引名称,后边是请求 段信息 说明  索引是面向分片的,是由于索引是由一个或多个分片( ...

  5. [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 ...

  6. [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 ...

  7. MAPPING SEGMENTS TO PAGES

    The segmentation and paging mechanisms provide in the support a wide variety of approaches to memory ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. SWERC13 Trending Topic

    map暴力. .. Imagine you are in the hiring process for a company whose principal activity is the analys ...

  2. Linux系统查看当前时间的命令

    转自:https://www.cnblogs.com/redfire/p/7702213.html 一.查看和修改Linux的时区1. 查看当前时区命令 : "date -R"2. ...

  3. 使用串口终端安装AIX操作系统

    使用串口终端安装AIX操作系统 一.配置超级终端 首先,配置超级终端:在笔记本电脑上(Windows XP系统),点击开始à程序->附件->通讯->超级终端,配置名称为test的超级 ...

  4. js作业

    1.一张纸的厚度是0.0001米,将纸对折,对折多少次厚度超过珠峰高度8848米var sum=0;i=0;a=0.0001;for(i=0;i<100;i++){ a=a*2; sum=sum ...

  5. NOIP2012 D2 T2 借教室 线段树 OR 二分法

    题目描述: 在大学期间,经常需要租借教室.大到院系举办活动,小到学习小组自习讨论,都需要向学校申请借教室.教室的大小功能不同,借教室人的身份不同,借教室的手续也不一样. 面对海量租借教室的信息,我们自 ...

  6. Android一对多蓝牙连接示例APP

    一对多蓝牙连接示例,基于Google BluetoothChat修改,实现一对多聊天(一个服务端.多个客户端),类似聊天室. 主要功能: 客户端的发出的消息所有终端都能收到(由服务端转发) 客户端之间 ...

  7. Singleton pattern的线程安全问题

    original post from here方法一:同步机制关键词public class Singleton { 2 //利用静态变量来记录Singleton的唯一实例 3 private sta ...

  8. R 连接DB2数据库,并制作词图

    #写在前面的话:此教程主要是用R连接了DB2数据库,并进行文本分析,制作了词图 #教程为markdown编写 ---title: "网站留言分析"output: html_docu ...

  9. 【Oracle】ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired

    出现此错误的原因是因为事务等待造成的,找出等待的事务,kill即可. 下面是我当时遇到的错误: ---删除表t1时出现错误 SCOTT@GOOD> drop table t1; drop tab ...

  10. 网站顶部显示预加载进度条preload.js

    网站加载的速度快的话,不会显示进度条加载时候的样式. 支持性主流浏览器都支持,ie浏览器需要9以上9也支持. 使用方法 <script src="http://code.jquery. ...