zoukankan      html  css  js  c++  java
  • The Solution of UESTC 2016 Summer Training #1 Div.2 Problem A

    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 ‘’. 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 ''.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;
    }

  • 相关阅读:
    圈水池 nyoj 78 凸包算法
    凸包算法入门
    nyoj 633 幂
    软件下载地址
    概率论与数理统计
    迷宫最短路径 问题
    将项目发布至开发环境测试环境的方法
    一些JavaScript技巧
    随机生成10个不重复的0-100的数字
    Git添加远程库和从远程库中获取(新手傻瓜式教学)
  • 原文地址:https://www.cnblogs.com/cs-lyj1997/p/5712732.html
Copyright © 2011-2022 走看看