题意翻译

题目描述

给你一个整数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. hdu 1002 A + B Problem II(大正整数相加)

    代码: #include<cstdio> #include<cstring> #define Min(a,b) ((a)<(b)?(a):(b)) using names ...

  2. 公司须要内部的地图服务,准备自己去开发可是成本太高,如今有没有专门为企业提供GIS地图开发的产品呀?大概价格多少?

    公司须要内部的地图服务,准备自己去开发可是成本太高,如今有没有专门为企业提供GIS地图开发的产品呀?大概价格多少?

  3. lightoj--1005--Rooks(组合数)

    Rooks Time Limit: 1000MS   Memory Limit: 32768KB   64bit IO Format: %lld & %llu Submit Status De ...

  4. friend(hdoj 1719)

    Friend Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Sub ...

  5. 【HAOI 2008】 移动玩具

    [题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=1054 [算法] 广度优先搜索 [代码] #include<bits/stdc+ ...

  6. CTF-Mayday

    打开下载的Mayday.txt文件: 温柔 知足突然好想你  拥抱突然好想你  拥抱温柔 知足温柔 知足突然好想你  拥抱突然好想你  拥抱温柔 知足温柔 知足突然好想你  拥抱突然好想你  拥抱温柔 ...

  7. USB接口大全

    USB2.0系列: Standard A: Standard B: Mini Standard B: Micro USB: ** Micro USB 与 Mini B比较 ** USB3.0系列: U ...

  8. 代码实现wordpress彩色标签云的最简单的方法

    首先在wordpress主题文件夹内找到并用编辑器打开 functions.php 文件,随意找个位置不到插到别的函数里,“?>” 之前加入以下代码: //彩色标签云 function colo ...

  9. 全能VIP音乐在线解析

    浏览器安装暴力猴扩展即可使用 // ==UserScript== // @name 全能VIP音乐在线解析 // @version 0.0.10 // @homepage https://greasy ...

  10. 一款APP的开发设计是如何从0到1一步一步设计的

    目前在行业里,关于APP界面设计规范也是层次不齐,很多都还停留在6的设备和ios 9的系统之上,而现在最新的是iphone 7和iOS 10了(更新换代真的很快),我这里说的是最新的iOS 界面设计规 ...