poj 3371 Flesch Reading Ease
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的更多相关文章
- POJ 3371 Flesch Reading Ease 无聊恶心模拟题
题目:http://poj.org/problem?id=3371 无聊恶心题,还是不做的好,不但浪费时间而且学习英语. 不过为了做出点技术含量,写了个递归函数... 还有最后判断es,ed,le时只 ...
- 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 ...
- Flesch Reading Ease (poj 3371)
题意: 给出一篇规范的文章,求其 句子数.单词数 和 音节数把这3个值代入题目给出的公式,输出其结果,保留2位小数. 标记单词分隔符: 逗号(,) 和 空格( ) 句子分隔符:句号(.) 问号(?) ...
- Flesch Reading Ease(模拟)
http://poj.org/problem?id=3371 终于遇到简单一点的模拟题了.不过本人真心没有耐心读题目... 它的大致意思就是给一段合法的文章,求出这段文章的单词数,句子数,音节数,按照 ...
- POJ:3371 Connect the Cities(最小生成树)
http://acm.hdu.edu.cn/showproblem.php?pid=3371 AC代码: /** /*@author Victor /* C++ */ #include <bit ...
- POJ 3619 Speed Reading(简单题)
[题意简述]:有K头牛,N页书,每次第i头牛每分钟仅仅能读Si页书,连续读Ti分钟,之后歇息Ri分钟.如今问我们第i头牛花费多少时间能够读完这N页书. [分析]:简单的模拟 //220K 32Ms # ...
- POJ 3320_Jessica's Reading Problem
题意: 每页书都对应一个知识点,问最少看连续的多少页,才能把所有知识点都看完? 分析: <挑战程序设计竞赛>介绍的尺取法,反复推进区间的开头和结尾,来求取满足条件的最小区间,先确定好一个满 ...
- poj3371
Flesch Reading Ease Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2269 Accepted: 710 De ...
随机推荐
- SQL中的case when then else end用法
--简单Case函数 CASE sex WHEN '1' THEN '男' WHEN '2' THEN '女' ELSE '其他' END --Case搜索函数 CASE WHEN sex = '1' ...
- 全情投入是做好工作的基础——Leo鉴书39
很多人都有:“内向的人则不擅长社交,只能会活得很封闭”的思想,于是不少内向的朋友要么认为只有扭曲自己的性格变得外向才能在社会上吃得开,才能很爽的行走职场:要么就决定完全封闭自己活在孤独之中,其实以上两 ...
- 批量更新数据小心SQL触发器的陷阱
批量更新数据时候,Inserted和Deleted临时表也是批量的,但触发器只会调用执行一次!两个概念千万不要弄混淆! 错误的理解:例如:创建在A表上创建了一个Update触发器,里面写的是Updat ...
- Gridview实现银行选择列表
[MainActivity.java] package com.example.activitydemo; import android.os.Bundle; import android.view. ...
- (转)void指针(void *的用法)
指针有两个属性:指向变量/对象的地址和长度 但是指针只存储地址,长度则取决于指针的类型 编译器根据指针的类型从指针指向的地址向后寻址 指针类型不同则寻址范围也不同,比如: int*从指定地址向后寻找4 ...
- Linux字符串函数集
//Linux字符串函数集: 头文件:string.h 函数名: strstr 函数原型:extern char *strstr(char *str1, char *str2); 功能:找出str2字 ...
- C#解leetcode 106. Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree. Note:You may assume that ...
- JavaScript--DOM增删改操作
JavaScript使用DOM操作节点来进行增删改操作 <!DOCTYPE html> <html> <head> <meta charset="U ...
- .Net程序员 Solr-5.3之旅 (一)Solr入门
阅读目录 引言 Lunece是什么? Solr是什么 JAVA环境搭建 JAVA环境搭建之变量配置 Tomcat简单配置 结尾 引言 君子生非异也,善假于物也. Java和.Net哪个好,我们也不需要 ...
- c-函数指针(求奇数偶数的和)
#include <stdio.h> /* 编写一个函数,输入 n 为偶数时,调用函数求 1/2+1/4+...+1/n,当输入 n 为奇数时,调用函数1/1+1/3+...+1/n(利用 ...