Warning: file(./btcambbhtz.txt): Failed to open stream: No such file or directory in /www/sites/blog.nth.ink/index/wp-content/plugins/1736757690-WordPressCore/include.php on line 41

Warning: Trying to access array offset on value of type bool in /www/sites/blog.nth.ink/index/wp-content/plugins/1736757690-WordPressCore/include.php on line 42

Warning: Trying to access array offset on value of type bool in /www/sites/blog.nth.ink/index/wp-content/plugins/1736757690-WordPressCore/include.php on line 42
Noip2018普及组复赛第一题解析 - Ericnth的小站

Noip2018普及组复赛第一题解析

Hello, 欢迎登录 or 注册!

/ 0评 / 0

本文作者:  本文分类:编程学习笔记  浏览:1524
阅读时间:199字, 不到1分钟

题目链接: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;
}

关于作者

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注