标题计数

Luogu
IDLGP8506
Time1000ms
Memory512MB
DifficultyP1
字符串洛谷原创洛谷月赛
Markdown 是一种标记语言。在 Markdown 中,若一行的第一个非空白字符是井号(#),且紧跟着若干个空格,则这一行剩余的**非空白**内容将会按照一级标题渲染。 在本题范围内,下面的都是一级标题: ```plaintext # This is a title # This is another title # This is also a title # You#can#add#more#sharps # # ``` 在本题范围内,下面的都不是一级标题: ```plaintext <h1>an HTML title</h1> #You should insert a space ## This is a secondary title aaaaa # This is not a title at all # You should add something after the sharp sign ``` 给定一段多行文本,求出这段文本总共有多少个一级标题。 ## Input 第一行输入一个整数 $n$,代表文本的行数。 接下来输入 $n$ 行,是给出的标记文本。 ## Output 输出一行一个整数,为这段文本中的一级标题个数。 [samples] ## Background 5ab 试图帮洛谷写机器人,数题解中有多少个一级标题。 ## Note #### 样例 3 解释 第 2,3,8,10 行(文本第 1,2,7,9 行)是满足条件的一级标题。 --- 如果选手在比赛中使用 Windows 系统,则直接从网站或下发题面中复制的样例的换行符是 CRLF,与真实数据中的 LF 会有区别。为了方便调试,建议使用下发文件中的样例进行测试,并直接使用文件输入输出。 ### 数据规模与约定 总文本不超过 $100$ 个字符,不超过 $10$ 行。文本中只有英文字母,井号(`#`),换行符(Line Feed,LF,`\n`)和空格。 $$ \def\arraystretch{1.5} \begin{array}{|c|c|}\hline \bf{测试点} & \bf{文本特殊性质} \\ \hline 1 & 没有空白字符 \\\hline 2,3& 只有\ 1\ 行 \\\hline 4,5 & / \\\hline \end{array} $$
Samples
Input #1
1
#u#n#t#i#t#l#e#d#
Output #1
0
Input #2
1
# a perfect title
Output #2
1
Input #3
10
# a
 # b
## c
#d
#  
e
# f#g#h#i#j
  ##k
# #
l # m
Output #3
4
API Response (JSON)
{
  "problem": {
    "name": "标题计数",
    "description": {
      "content": "Markdown 是一种标记语言。在 Markdown 中,若一行的第一个非空白字符是井号(#),且紧跟着若干个空格,则这一行剩余的**非空白**内容将会按照一级标题渲染。 在本题范围内,下面的都是一级标题: ```plaintext # This is a title #    This is another title     # This is also a title     #   ",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 524288
    },
    "difficulty": {
      "LuoguStyle": "P1"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGP8506"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Markdown 是一种标记语言。在 Markdown 中,若一行的第一个非空白字符是井号(#),且紧跟着若干个空格,则这一行剩余的**非空白**内容将会按照一级标题渲染。\n\n在本题范围内,下面的都是一级标题:\n\n```plaintext\n# This is a title\n#    This is another title\n    # This is also a title\n    #   ...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments