Link

http://acm.hust.edu.cn/vjudge/contest/121539#problem/A

Description

standard input/output

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

Input
3
Output
4
Input
7
Output
8
Input
64
Output
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的更多相关文章

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

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

  3. UESTC 2016 Summer Training #6 Div.2

    我好菜啊.. UVALive 6434 给出 n 个数,分成m组,每组的价值为最大值减去最小值,每组至少有1个,如果这一组只有一个数的话,价值为0 问 最小的价值是多少 dp[i][j] 表示将 前 ...

  4. UESTC 2016 Summer Training #1 Div.2

    最近意志力好飘摇..不知道坚不坚持得下去.. 这么弱还瞎纠结...可以滚了.. 水题都不会做.. LCS (A) 水 LCS (B) 没有看题 Gym 100989C 水 1D Cafeteria ( ...

  5. UESTC 2016 Summer Training #1 J - Objects Panel (A) 按条件遍历树

    #include <iostream> #include <cstdio> #include <vector> using namespace std; typed ...

  6. 2016 Multi-University Training Contests

    2016 Multi-University Training Contest 1 2016 Multi-University Training Contest 2 2016 Multi-Univers ...

  7. 2016 Multi-University Training Contest 2 D. Differencia

    Differencia Time Limit: 10000/10000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Tot ...

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

  9. 2016 Multi-University Training Contest 1

    8/11 2016 Multi-University Training Contest 1 官方题解 老年选手历险记 最小生成树+线性期望 A Abandoned country(BH) 题意: 1. ...

随机推荐

  1. android 蓝牙 http://blog.csdn.net/u012843100/article/details/52384219

    http://blog.csdn.net/u012843100/article/details/52384219

  2. 安装SQL Developer,连接Oracle 12c,创建新用户

    1.访问Oracle官网:https://www.oracle.com/index.html,下载SQL Developer 2.安装... 3.打开Sql Developer,右键"创建新 ...

  3. for_each(c++11)

    http://www.cplusplus.com/reference/algorithm/for_each/ template<class InputIterator, class Functi ...

  4. tp框架之AJAX

    实现一个AJAX添加并显示数据的例子 控制器 <?php namespace Home\Controller; use Think\Controller; class AjaxControlle ...

  5. https://github.com/chenghuige/tensorflow-exp/blob/master/examples/sparse-tensor-classification/

        https://github.com/chenghuige/tensorflow-exp/blob/master/examples/sparse-tensor-classification/ ...

  6. Tensorflow serving的编译

    Tensorflow serving提供了部署tensorflow生成的模型给线上服务的方法,包括模型的export,load等等. 安装参考这个 https://github.com/tensorf ...

  7. Java面试连环炮问题收集记录贴【JVM方面】

    写这类文章是为了记录下网上看到的/自己经历的一些一环扣一环的面试问题,一方面提高自己的理论知识,另外一方面也给自己去参加面试或面试他人提供点参考和帮助. 问题一: 为什么一个对象会被GC? 对象在进行 ...

  8. Android-Menu [使用C# And Java实现]

    本篇是对安卓菜单使用编程方式实现,当然可以使用XML的方式完成同样的功能,基本Java和C#写法都是一致的,所以使用XML的方式在本篇中使用Java演示,需要注意的是,对于如果不是VS开发的话,那么资 ...

  9. TDD学习笔记【二】---单元测试简介

    大纲 Testing 的第一个切入点:单元测试. 本篇文章将针对单元测试进行简介,主要内容包含了5W: Why What Where Who When 而How 的部分,属于实现部分,将于下一篇文章介 ...

  10. EF for MySql 开发配置手册

    执行MySQL安装程序,安装MySQL For Visual Studio和Connector/NET 执行命令: Install-Package EntityFramework Install-Pa ...