题解 | #[NOIP2018]标题统计#
[NOIP2018]标题统计
https://www.nowcoder.com/practice/b14b87bc6a4547a6839e0a5867c98dba
emm看了一圈大伙的答案,好像都着重在scanf不能吸收空格或换行的特点上了,但是为什么没人利用一下呢?
个人认为这道题偷跑的方法,应该是C语言代码中最简单的了,代码如下:
#include <stdio.h>
#include <string.h>int main()
{
char str[1000];
int count=0;
while(scanf("%s",str)!=EOF)
{
for(int i=0;i<strlen(str);i++)
{
count++;
}
}
printf("%d",count);
return 0;
}