The Solution of UESTC 2016 Summer Training #1 Div.2 Problem A
Link
http://acm.hust.edu.cn/vjudge/contest/121539#problem/A
Description
Haneen is trying to solve an easy problem given by Dr. Ibrahim in the Algorithms course. The problem is to find the lexicographically smallest Longest Common Subsequence (LCS) between two strings. Unfortunately, she got many runtime errors. After tens of wrong submissions, she asked Master Hazem about the problem and he replied:
"C strings are terminated with the null character ‘\0’. When you want to store a string of length N, the size of the array should be at leastN + 1."
Haneen didn’t get anything of what he said, and now, she is in need of your help! Given the length of the string Haneen has, determine the minimum size of an array needed to store this string.
Input
The input contains a single integer N(1 ≤ N ≤ 105), the length of the string.
Output
Print the minimum size of an array needed to store the string.
Sample Input
3
4
7
8
64
65
Solution
This is an easy question.The description of the problem has told us C strings usually prepare an extra space for the null character '\0'.So,just input an integer n,then output n+1.
C++ Code
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
cout<<n+1<<endl;
return 0;
}
The Solution of UESTC 2016 Summer Training #1 Div.2 Problem A的更多相关文章
- The Solution of UESTC 2016 Summer Training #1 Div.2 Problem C
Link http://acm.hust.edu.cn/vjudge/contest/121539#problem/C Description standard input/output After ...
- The Solution of UESTC 2016 Summer Training #1 Div.2 Problem B
Link http://acm.hust.edu.cn/vjudge/contest/121539#problem/B Description standard input/output Althou ...
- UESTC 2016 Summer Training #6 Div.2
我好菜啊.. UVALive 6434 给出 n 个数,分成m组,每组的价值为最大值减去最小值,每组至少有1个,如果这一组只有一个数的话,价值为0 问 最小的价值是多少 dp[i][j] 表示将 前 ...
- UESTC 2016 Summer Training #1 Div.2
最近意志力好飘摇..不知道坚不坚持得下去.. 这么弱还瞎纠结...可以滚了.. 水题都不会做.. LCS (A) 水 LCS (B) 没有看题 Gym 100989C 水 1D Cafeteria ( ...
- UESTC 2016 Summer Training #1 J - Objects Panel (A) 按条件遍历树
#include <iostream> #include <cstdio> #include <vector> using namespace std; typed ...
- 2016 Multi-University Training Contests
2016 Multi-University Training Contest 1 2016 Multi-University Training Contest 2 2016 Multi-Univers ...
- 2016 Multi-University Training Contest 2 D. Differencia
Differencia Time Limit: 10000/10000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Tot ...
- 2016 Multi-University Training Contest 1 G. Rigid Frameworks
Rigid Frameworks Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) ...
- 2016 Multi-University Training Contest 1
8/11 2016 Multi-University Training Contest 1 官方题解 老年选手历险记 最小生成树+线性期望 A Abandoned country(BH) 题意: 1. ...
随机推荐
- xcode添加快捷代码块
添加快捷代码块 在开发过程中,一些常用的代码段,我们可以设置成快捷代码段来快速实现代码的编写. 如上图中的属性的设置,它们都有相同重复的代码@property (nonatomic, strong), ...
- css实现容器垂直水平居中的七中方法
方法一:position加margin 方法二: diaplay:table-cell 方法三:position加 transform 方法四:flex;align-items: center;jus ...
- Linux时间同步,ntpdate命令、ntpd服务详解
声明:以下内容来自网友整理(http://blog.sina.com.cn/s/blog_636a55070101u1mg.html),为便于以后学习暂时收录,请不要随意转载 Linux默认情况下,系 ...
- gulp使用过程中出现的问题
在使用gulp的过程中,最容易出现错误的地方就是在安装本地的gulp的时候,错误的原因有: 1.本来是局部安装gulp,但使用命令时还带-g. 2.忘记在局部安装gulp. 以上两种情况出错时会报错, ...
- C++ 系列:静态库与动态库
转载自http://www.cnblogs.com/skynet/p/3372855.html 这次分享的宗旨是——让大家学会创建与使用静态库.动态库,知道静态库与动态库的区别,知道使用的时候如何选择 ...
- Linux上搭建Hadoop2.6.3集群以及WIN7通过Eclipse开发MapReduce的demo
近期为了分析国内航空旅游业常见安全漏洞,想到了用大数据来分析,其实数据也不大,只是生产项目没有使用Hadoop,因此这里实际使用一次. 先看一下通过hadoop分析后的结果吧,最终通过hadoop分析 ...
- ios 获取手机的IP地址
- (NSString *)getIPAddress:(BOOL)preferIPv4{ NSArray *searchArray = preferIPv4 ? @[ IOS_VPN @"/ ...
- 【多线程】java多线程 测试例子 详解wait() sleep() notify() start() join()方法 等
java实现多线程,有两种方法: 1>实现多线程,继承Thread,资源不能共享 2>实现多线程 实现Runnable接口,可以实现资源共享 *wait()方法 在哪个线程中调用 则当前 ...
- TMS320F28027/26/23/22/21/20芯片解密单片机破解原理!
TMS320F28027/26/23/22/21/20芯片解密单片机破解 TMS320F2802系列芯片解密型号: TMS320F28027F.TMS320F280270.TMS320F28027.T ...
- 调用0A中断输入字符串数据段的DUP定义
;这是自动生成的代码模板 STACKS SEGMENT STACK ;堆栈段 DW DUP(?) ;注意这里只有128个字节 STACKS ENDS DATAS SEGMENT ;数据段 STRING ...