http://poj.org/problem?id=3371

终于遇到简单一点的模拟题了。不过本人真心没有耐心读题目。。。

它的大致意思就是给一段合法的文章,求出这段文章的单词数,句子数,音节数,按照题目给出的公式带入就出结果。

>因为输入是按空格作为字符串结束标志的,因此每输入一个字符串就是一个单词,

>句子结束的标志是 . ? : ; !五种,每输入一个字符串只须判断其最后一个字符是否是 . ? : ; !的一种,若是,句子数加1.

>对于音节数,单词长度<=3的为一个音节,

大于3的情况下,句子中有元音 a(A),e(E),i(I),o(O),u(U),y(Y)时音节数加1,但如果有连续的元音字母按1个算,如果单词以 -es 或 -ed 或 -e(不包括-le)结尾,不算一个音节。

 #include<stdio.h>
#include<string.h>
#include<iostream>
#include<ctype.h>
using namespace std; bool check_sentences(char ch)
{
if(ch == '.' || ch == '?' || ch == ':' || ch == ';' || ch == '!')
return true;
return false;
} bool check_syllables(char ch)
{
if(ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' || ch == 'y'
|| ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U' || ch == 'Y')
return true;
return false; } int main()
{
int sentences = ;//句子数
int words = ;//单词数
int syllables = ;//音节数
int len,i;
char s[]; while(cin>>s)
{
len = strlen(s); if(check_sentences(s[len-]))
sentences++; words++; while(!isalpha(s[len-]))
len--; if(len <= )
syllables++;//单词长度<=3时,音节数加1
else
{
if(check_syllables(s[])) syllables++; for(i = ; i < len; i++)
{
if(check_syllables(s[i]) && !check_syllables(s[i-]))
syllables++;
}
//去除以 -es -ed -e(除-le)结尾的情况
if(!check_syllables(s[len-]) && s[len-] == 'e' && (s[len-] == 's'|| s[len-] == 'd'))
syllables--;
if(!check_syllables(s[len-]) && s[len-] == 'e' && s[len-] != 'l')
syllables--;
}
}
double ans;
ans = 206.835-1.015*(words*1.0/sentences)-84.6*(syllables*1.0/words);
printf("%.2lf\n",ans);
return ;
}

Flesch Reading Ease(模拟)的更多相关文章

  1. POJ 3371:Flesch Reading Ease 模拟

    Flesch Reading Ease Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 2071   Accepted: 60 ...

  2. Flesch Reading Ease -POJ3371模拟

    Flesch Reading Ease Time Limit: 1000MS Memory Limit: 65536K Description Flesch Reading Ease, a reada ...

  3. POJ 3371 Flesch Reading Ease 无聊恶心模拟题

    题目:http://poj.org/problem?id=3371 无聊恶心题,还是不做的好,不但浪费时间而且学习英语. 不过为了做出点技术含量,写了个递归函数... 还有最后判断es,ed,le时只 ...

  4. Flesch Reading Ease (poj 3371)

    题意: 给出一篇规范的文章,求其 句子数.单词数 和 音节数把这3个值代入题目给出的公式,输出其结果,保留2位小数. 标记单词分隔符: 逗号(,) 和 空格( ) 句子分隔符:句号(.) 问号(?) ...

  5. poj 3371 Flesch Reading Ease

    http://poj.org/problem?id=3371 #include<cstdio> #include<cstring> #include<algorithm& ...

  6. poj3371

    Flesch Reading Ease Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2269 Accepted: 710 De ...

  7. Readability Assessment for Text Simplification -paper

    https://pdfs.semanticscholar.org/e43a/3c3c032cf3c70875c4193f8f8818531857b2.pdf 1.introduction在Brazil ...

  8. 884A. Book Reading#抽空学习好孩子(模拟)

    题目出处:http://codeforces.com/problemset/problem/884/A 题目大意:每天时间分两部分,工作和学习,工作优先,闲暇读书,问第几天读完 #include< ...

  9. Codeforces Round #653 (Div. 3) E1. Reading Books (easy version) (贪心,模拟)

    题意:有\(n\)本书,A和B都至少要从喜欢的书里面读\(k\)本书,如果一本书两人都喜欢的话,那么他们就可以一起读来节省时间,问最少多长时间两人都能够读完\(k\)本书. 题解:我们可以分\(3\) ...

随机推荐

  1. navigation的pushViewController卡顿问题

    问题:在ios中一个viewController中,添加下面代码: <pre name="code" class="objc">UIViewCont ...

  2. 省市联级菜单--js+html

    <!DOCTYPE html> <html> <head> <title></title> </head> <body&g ...

  3. Oracle 卸载 不干净

    关闭oracle相关的服务 注册表删除(可能因为oracle及windows的版本不同注册表信息也有些差异): 开始è输入regedit 打开注册表编辑器删除下面的目录 HKEY_LOCAL_MACH ...

  4. 含有GROUP BY子句的查询中如何显示COUNT()为0的成果(分享)

    在SQL Server数据库查询中,为了对查询成果进行对比.解析,我们经常会用到GROUP BY子句以及COUNT()函数来对查询成果进行分类.统计等.然则我们在应用的过程中往往会存在一些题目,本文我 ...

  5. Convention插件的使用(会涉及content目录,jsp必须放入这个下面才能映射成功基于注解的配置)

    http://blog.csdn.net/zclandzzq/article/details/7107816

  6. UIView下使用Animation控制动画

    转载自:http://blog.csdn.net/xunyn/article/details/8128031 动画效果是IOS界面重要的特色之一,其中CAAnimation是所有动画对象的抽象父类,作 ...

  7. HDU5311 Hidden String

    Problem Description Today is the 1st anniversary of BestCoder. Soda, the contest manager, gets a str ...

  8. 初试ubuntu14.4问题集锦

    接触Linux系统也好长时间了,但每次都是浅尝则止.前几天突发兴趣,想认真地学习一下这个名扬天下的稳定的操作系统.于是试着装了一下炒作的最凶的Ubuntu. 安装的Ubuntu系统版本为14.04. ...

  9. SGU 154.Factorial

    时间限制:0.25s 空间限制:4M 题意 你的任务是找到最小自然数 N, 使N!在十进制下包含 Q个零. 众所周知 N! = 1*2*...*N. 例如, 5! = 120, 120 结尾包含1个零 ...

  10. SQL UNION 和 UNION ALL 操作符

    SQL UNION 和 UNION ALL 操作符 SQL Full Join SQL Select Into SQL UNION 操作符 UNION 操作符用于合并两个或多个 SELECT 语句的结 ...