Title: give you three sentences to determine whether the number of consecutive vowels (including y) in three sentences is 5,7,5.
Analysis: A simple question. can be solved directly.
stating: ╮(╯▽╰)╭.
#include <cstdio> #include <cstring>int maps[256];int size[3];char buf[202];int Main () {memset ( Maps, 0, sizeof (maps)), maps[' a '] = maps[' e '] = maps[' i '] = maps[' o '] = maps[' u '] = maps[' y '] = 1;while (gets (BUF)) {if (!s TRCMP (buf, "e/o/i")) break;int item = 0;size[0] = size[1] = size[2] = 0;for (int i = 0; buf[i]; + + i) {if (buf[i] = = '/') + + item;if (i = = 0 | |!maps[buf[i-1]]) Size[item] + + maps[buf[i]];} if (size[0]! = 5) puts ("1"), else if (size[1]! = 7) puts ("2"), else if (size[2]! = 5) puts ("3"); else puts ("Y");} return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
UVa 576-haiku Review