题解 | #[NOIP2018]标题统计#
[NOIP2018]标题统计
https://www.nowcoder.com/practice/b14b87bc6a4547a6839e0a5867c98dba
#include <iostream>
#include <cstring>
using namespace std;
#define N 5000
int main() {
char a[N];
scanf("%[^\n]",a);
int count = 0;
for(int i = 0 ; i < strlen(a) ; i++){
if(a[i] == ' ')
continue;
count++;
}
cout << count << endl;
return 0;
}
// 64 位输出请用 printf("%lld")
利用字符串数组最后过滤‘’”
查看2道真题和解析