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. Objective-C:KVO

    @import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css); @import url(/ ...

  2. 获取服务器端ip

    System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]

  3. EntityFrameowk6.1 使用enum和低版本的不同

    原有项目中使用EF5.0 实体类 public partial class Log : BaseEntity { public Nullable<int> LogLevelId { get ...

  4. 谈谈oracle中的临时表

    --------------------创建临时表 临时保存从xml字符串解析来的数据--------------------------- 会话级别临时表SQL> create global ...

  5. javascript社交平台分享-新浪微博、QQ微博、QQ好友、QQ空间、人人网

    整理的五个社交平台的分享 <!doctype html> <html lang="en"> <head> <meta charset=&q ...

  6. SGU 123.The sum

    #include <iostream> using namespace std; int f[50]={0,1,1}; int main(){ int n,s=0; cin>> ...

  7. 【HDU4366】【DFS序+分块】Successor

    Problem Description Sean owns a company and he is the BOSS.The other Staff has one Superior.every st ...

  8. 《find技巧》-“linux命令五分系列”之一

    一天一个命令,做个记录, 我要成大神,哈哈哈 本原创文章属于<Linux大棚>博客. 博客地址为http://roclinux.cn. 文章作者为roc 希望您能通过捐款的方式支持Linu ...

  9. CetnOS minimal 网络不可用

    系统版本: CentOS-6.6-i386-minimal 问题说明: CentOS minimal 在安装完成之后,网络不可用,一些常见的命令报错,如: ping: unknow host xxxy ...

  10. JqGrid自定义toolbar

    1.设置toolbar参数为[true,"top"],其意思是toolbar显示在Grid顶部,且其id为t_+Grid的id.e.g.: Grid的id为myGrid,toolb ...