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

 #include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#define maxn 2000
using namespace std;
char s[maxn];
int word=,sen=,syll=;
bool check(char ch)
{
if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'||ch=='y')
return true;
if(ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U'||ch=='Y')
return true;
return false;
}
int main()
{
while(cin>>s)
{
int i;
int wordlen=;
int syl=;
bool flag=false;
for(i=; s[i]; i++)
{
if((s[i]>='a'&&s[i]<='z')||(s[i]>='A'&&s[i]<='Z'))
{
wordlen++;
if(wordlen<=)
{
if(!((s[i+]>='a'&&s[i+]<='z')||(s[i+]>='A'&&s[i+]<='Z')))
{
syll++;
syll-=syl;
syl=;
continue;
}
}
if(check(s[i]))
{
if(s[i]=='e')
{
if((!((s[i+]>='a'&&s[i+]<='z')||(s[i+]>='A'&&s[i+]<='Z')))&&s[i-]=='l')
{
syll++;
syl++;
continue;
}
else if(!((s[i+]>='a'&&s[i+]<='z')||(s[i+]>='A'&&s[i+]<='Z')))
continue;
else if((s[i+]=='d'||s[i+]=='s')&&(!((s[i+]>='a'&&s[i+]<='z')||(s[i+]>='A'&&s[i+]<='Z'))))
{
continue;
}
}
if(!flag)
{
flag=true;
syll++;
syl++;
continue;
}
else
continue;
}
flag=false;
}
else if(s[i]==',')
{
flag=false;
wordlen=;
syl=;
word++;
}
else if(s[i]=='.'||s[i]=='?'||s[i]=='!'||s[i]==':'||s[i]==';')
{
flag=false;
wordlen=;
word++;
syl=;
sen++;
}
}
if((s[i-]>='a'&&s[i-]<='z')||(s[i-]>='A'&&s[i-]<='Z'))
{
word++;
}
}
printf("%.2lf\n",(206.835-1.015*word*1.0/sen-84.6*syll*1.0/word));
return ;
}

poj 3371 Flesch Reading Ease的更多相关文章

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

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

  2. POJ 3371:Flesch Reading Ease 模拟

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

  3. Flesch Reading Ease -POJ3371模拟

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

  4. Flesch Reading Ease (poj 3371)

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

  5. Flesch Reading Ease(模拟)

    http://poj.org/problem?id=3371 终于遇到简单一点的模拟题了.不过本人真心没有耐心读题目... 它的大致意思就是给一段合法的文章,求出这段文章的单词数,句子数,音节数,按照 ...

  6. POJ:3371 Connect the Cities(最小生成树)

    http://acm.hdu.edu.cn/showproblem.php?pid=3371 AC代码: /** /*@author Victor /* C++ */ #include <bit ...

  7. POJ 3619 Speed Reading(简单题)

    [题意简述]:有K头牛,N页书,每次第i头牛每分钟仅仅能读Si页书,连续读Ti分钟,之后歇息Ri分钟.如今问我们第i头牛花费多少时间能够读完这N页书. [分析]:简单的模拟 //220K 32Ms # ...

  8. POJ 3320_Jessica's Reading Problem

    题意: 每页书都对应一个知识点,问最少看连续的多少页,才能把所有知识点都看完? 分析: <挑战程序设计竞赛>介绍的尺取法,反复推进区间的开头和结尾,来求取满足条件的最小区间,先确定好一个满 ...

  9. poj3371

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

随机推荐

  1. java 复用类的三种方式区别 组合,继承,代理的区别

    1. 组合 : 只需在新类中产生现有类的对象 .(is - a 有一个) 新类是由现有类的对象组成. (引用初始化与作用域?) 2. 继承 : 按照现有类的类型来创造新类. (has - a 有一个) ...

  2. MyBatis总结-实现关联表查询

    一.一对一关联 1.1.提出需求 根据班级id查询班级信息(带老师的信息) 1.2.创建表和数据 创建一张教师表和班级表,这里我们假设一个老师只负责教一个班,那么老师和班级之间的关系就是一种一对一的关 ...

  3. padding与margin的差别

    之前一直没有搞懂android:padding和android:layout_margin的差别,事实上概念非常easy,padding是站在父view的角度描写叙述问题,它规定它里面的内容必须与这个 ...

  4. [转] C语言多维数组与多级指针

    http://c.biancheng.net/cpp/html/477.html 多维数组与多级指针也是初学者感觉迷糊的一个地方.超过二维的数组和超过二级的指针其实并不多用.如果能弄明白二维数组与二级 ...

  5. ST表poj3264

      /* ST表多次查询区间最小值 设 g[j][i] 表示从第 i 个数到第 i + 2 ^ j - 1 个数之间的最小值 类似DP的说 ans[i][j]=min (ans[i][mid],ans ...

  6. 构建可比较的对象(IComparable)

    IComparable接口 System.IComparable接口指定了一种允许一个对象可基于某些特定键值进行排序的行为. namespace System { [ComVisible(true)] ...

  7. Linq101-Aggregate

    using System; using System.Collections.Generic; using System.Linq; namespace Linq101 { class Aggrega ...

  8. php创建读取 word.doc文档

    创建文档; <?php $html = "this is question"; for($i=1;$i<=3;$i++){ $word = new word(); $w ...

  9. 生成PDF并下载。

    例子是生成一个pdf格式的证书: //创建Document Document document = null; //为该Document创建一个Writer实例 PdfWriter writer = ...

  10. ORACLE_DBA管理脚本

    SYS @ prod >col index_name for a10 SYS @ prod >col table_name for a10 SYS @ prod >col start ...