UVA_494:Kindergarten Counting Game】的更多相关文章

Language: C++ 4.8.2 #include<stdio.h> #include<ctype.h> int main(void) { int ch; int word_count = 0; int in_word = 1; // 标志变量辅助字符串读入 while((ch=getchar()) != EOF) { if(ch == '\n') { printf("%d\n", word_count); word_count = 0; in_word…
欢迎访问我的新博客:http://www.milkcu.com/blog/ 原文地址:http://www.milkcu.com/blog/archives/uva494.html 题目描述  Kindergarten Counting Game  Everybody sit down in a circle. Ok. Listen to me carefully. ``Woooooo, you scwewy wabbit!'' Now, could someone tell me how ma…
 Kindergarten Counting Game  Everybody sit down in a circle. Ok. Listen to me carefully. ``Woooooo, you scwewy wabbit!'' Now, could someone tell me how many words I just said? Input and Output Input to your program will consist of a series of lines,…
题目大意:输入一个字字符串,输出该字符串中所包含的"word"个数,其中"word"是指连续的字母(大小写均可) 题目思路:其实这是道水题,不过我考虑的时候,太想当然了,我是把空格作为每个子串的分界,遇到一个空格就去判断空格前的子串是否为单词. 然而实际上并不是这样,如果是连续的符号中夹杂着单词的话,就不好判断. 正确思路:对每个输入的字符进行判断,每当遇到非字母的字符时,进行单词判断. (有两点注意:1.输入为回车时,应输出结果并且初始化.2.输入为EOF(-1)…
#include<bits/stdc++.h>using namespace std;int main(){ int n=0; char a; int flag=1; while((scanf("%c",&a)!=EOF)) { if(a>='a'&&a<='z'||a>='A'&&a<='Z') { flag=1; } else{if(flag) n++;flag=0;} if(a=='\n') {cout&…
Everybody sit down in a circle. Ok. Listen to me carefully.“Woooooo, you scwewy wabbit!”Now, could someone tell me how many words I just said?InputInput to your program will consist of a series of lines, each line containing multiple words (at least…
题号:a001: 哈囉 背景知识:输出语句,while not eof 题号:a002: 簡易加法 背景知识:输出语句,while not eof,加法运算 题号:a003: 兩光法師占卜術 背景知识:while not eof,分支语句,求余 PS:%表示求余 题号:a004: 文文的求婚 背景知识:while not eof,分支语句,判断闰年 题号:a005: Eva 的回家作業 背景知识:循环,if语句,等比数列,等差数列,输出语句 题号:a006: 一元二次方程式 背景知识:if语句的…
题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics 10300 - Ecological Premium 458 - The Decoder 494 - Kindergarten Counting Game 414 - Machined Surfaces 490 - Rotating Sentences 445 - Marvelous Mazes…
AOAPC I: Beginning Algorithm Contests (Rujia Liu) Volume 0. Getting Started 10055 - Hashmat the Brave Warrior 153793   27.33% 33385   85.74% 10071 - Back to High School Physics 76581   50.07% 28855   93.71% 10300 - Ecological Premium 26621   66.39% 1…
 Kindergarten Counting Game  Everybody sit down in a circle. Ok. Listen to me carefully. ``Woooooo, you scwewy wabbit!'' Now, could someone tell me how many words I just said? Input and Output Input to your program will consist of a series of lines,…