Flesch Reading Ease(模拟)
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(模拟)的更多相关文章
- POJ 3371:Flesch Reading Ease 模拟
Flesch Reading Ease Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2071 Accepted: 60 ...
- Flesch Reading Ease -POJ3371模拟
Flesch Reading Ease Time Limit: 1000MS Memory Limit: 65536K Description Flesch Reading Ease, a reada ...
- POJ 3371 Flesch Reading Ease 无聊恶心模拟题
题目:http://poj.org/problem?id=3371 无聊恶心题,还是不做的好,不但浪费时间而且学习英语. 不过为了做出点技术含量,写了个递归函数... 还有最后判断es,ed,le时只 ...
- Flesch Reading Ease (poj 3371)
题意: 给出一篇规范的文章,求其 句子数.单词数 和 音节数把这3个值代入题目给出的公式,输出其结果,保留2位小数. 标记单词分隔符: 逗号(,) 和 空格( ) 句子分隔符:句号(.) 问号(?) ...
- poj 3371 Flesch Reading Ease
http://poj.org/problem?id=3371 #include<cstdio> #include<cstring> #include<algorithm& ...
- poj3371
Flesch Reading Ease Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2269 Accepted: 710 De ...
- Readability Assessment for Text Simplification -paper
https://pdfs.semanticscholar.org/e43a/3c3c032cf3c70875c4193f8f8818531857b2.pdf 1.introduction在Brazil ...
- 884A. Book Reading#抽空学习好孩子(模拟)
题目出处:http://codeforces.com/problemset/problem/884/A 题目大意:每天时间分两部分,工作和学习,工作优先,闲暇读书,问第几天读完 #include< ...
- Codeforces Round #653 (Div. 3) E1. Reading Books (easy version) (贪心,模拟)
题意:有\(n\)本书,A和B都至少要从喜欢的书里面读\(k\)本书,如果一本书两人都喜欢的话,那么他们就可以一起读来节省时间,问最少多长时间两人都能够读完\(k\)本书. 题解:我们可以分\(3\) ...
随机推荐
- Emoji表情处理
//php对于 Emoji表情的处理 //当接收内容需要转换时: //preg_replace_callback('/[\xf0-\xf7].{3}/','cal_fun', $str) functi ...
- eclipse 常见问题及解决
1. Target runtime Apache Tomcat v6.0 is not defined.错误解决方法 原文:http://blog.csdn.net/xw13106209/articl ...
- C## 输出Hello world
首先新建一个项目 然后在文件D:\C##Obj\HelloWorld\HelloWorld\Program.cs using System; using System.Collections.Gene ...
- HashMap深度解析(二)
本文来自:高爽|Coder,原文地址:http://blog.csdn.net/ghsau/article/details/16890151 上一篇比较深入的分析了HashMap在put元素时的整体过 ...
- HashMap深度解析(一)
本文来自:高爽|Coder,原文地址:http://blog.csdn.net/ghsau/article/details/16843543 HashMap可以说是Java中最常用的集合类框架之一,是 ...
- 完全卸载oracle
今天在网上看到有位网友写的篇日志,感觉蛮好的,一般卸载oracle有4个地方需求注意:1)Services,2)software,3eventlog,4)path. 1.关闭 oracle 所有的服务 ...
- mysql出现的错误
(一)ERROR 1005 (HY000): Can't create table '.\day19\user_role.frm' (errno: 121) 今天遇到的这个问题是因为创建了五张表,其中 ...
- index ffs、index fs原理考究-1109
h2 { margin-top: 0.46cm; margin-bottom: 0.46cm; direction: ltr; line-height: 173%; text-align: justi ...
- 在模型中获取网络数据,刷新tableView
model .h #import <Foundation/Foundation.h> #import "AFHTTPRequestOperationManager.h" ...
- IE6 png兼容问题
1.IE6 png <!--[if IE 6]> <script src="../js/png.js" type="text/javascript& ...