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. Xcode6 viewDidLoad 中View的subviews 为空

    Xcode 6  中勾选using size Classes 方法,在ViewDidLoad 方法中调用outlet 的一个myView.subviews 会为空,而myView 不会为空. stor ...

  2. PHP中的循环while、do...while、for、foreach四种循环。

    php中的while循环,循环执行代码块制定的次数,或者当指定的条件为真时循环执行代码块. 在我们编写代码是时候,我们经常需要一块代码块重复执行多次.我们就可以使用while循环语句来完成这个任务. ...

  3. hadoop集群环境搭建之安装配置hadoop集群

    在安装hadoop集群之前,需要先进行zookeeper的安装,请参照hadoop集群环境搭建之zookeeper集群的安装部署 1 将hadoop安装包解压到 /itcast/  (如果没有这个目录 ...

  4. 使用PHP实现蜘蛛访问日志统计

    $useragent = addslashes(strtolower($_SERVER['HTTP_USER_AGENT'])); if (strpos($useragent, 'googlebot' ...

  5. 什么是JPA

    起源 JPA由EJB 3.0软件专家组开发,作为JSR-220实现的一部分.但它不囿于EJB 3.0,你可以在Web应用.甚至桌面应用中使用.JPA的宗旨是为POJO提供持久化标准规范,由此可见,经过 ...

  6. DataView操作DataTable

    1.DataView筛选数据 //假设有一个DataTable数据 DataTable dt = new DataTable(); //转成DefaultView DataView dv = dt.D ...

  7. 函数对象的prototype总结

    通过看 http://www.cnblogs.com/mindsbook/archive/2009/09/19/javascriptYouMustKnowPrototype.html 该文章和对代码的 ...

  8. 解决kernel headers报错

    Make sure you have updated version $ sudo apt-get update Search for kernel version (optional) $ apt- ...

  9. For Me ...

    一直有做博客的打算,但是这也看不上,那也看不上. 总想着做一个personal blog,界面,风格全由自己设计. 可时间上总是不充裕的. 可技术上总是欠火候的. 可内容上总是待斟酌的. 于是时间被我 ...

  10. 段落排版--缩进(text-indent)

    中文文字中的段前习惯空两个文字的空白,这个特殊的样式可以用下面代码来实现: p{text-indent:2em;} <p>1922年的春天,一个想要成名名叫尼克卡拉威(托比?马奎尔Tobe ...