Noip2018普及组复赛第一题解析

题目链接:https://www.luogu.org/problem/P5015

这道题目较简单,考察字符串的输入和处理。

代码如下:

#include <bits/stdc++.h>

char c;
int cnt;

int main() {
	while (c = getchar()) {
		if (c == EOF || c == '\n') break;
		if (c != ' ') cnt ++;
	}
	printf("%d\n", cnt);
	return 0;
}
0 0 vote
Article Rating
Subscribe
提醒
0 评论
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x