poj_3371
一道模拟题,写的有点麻烦
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
bool fun(char c)
{
if(c=='a'||c=='A'||c=='e'||c=='E'||c=='i'||c=='I'||c=='o'||c=='O'||c=='u'||c=='U'||c=='y'||c=='Y')
return true;
else
return false;
}
int main()
{
int word=0,sen=0,syl=0;
char s[1000];
while(scanf("%s",s)!=EOF)
{
int len=0,y=0;
int i;
for(i=0; s[i]!='\0'; i++)
{
if((s[i]>='a'&&s[i]<='z')||(s[i]>='A'&&s[i]<='Z'))
{
len++;
if(fun(s[i]))
{
if(s[i]=='e')
{
if(!((s[i+1]>='a'&&s[i+1]<='z')||(s[i+1]>='A'&&s[i+1]<='Z'))&& s[i-1]=='l')
{
syl++;
y++;
}
else if(!fun(s[i+1])&&((s[i+2]>='a'&&s[i+2]<='z')||(s[i+2]>='A'&&s[i+2]<='Z')))
{
if((s[i+1]>='a'&&s[i+1]<='z')||(s[i+1]>='A'&&s[i+1]<='Z'))
{syl++;
y++;
}
}
else if(!fun(s[i+1])&&((s[i+1]>='a'&&s[i+1]<='z')||(s[i+1]>='A'&&s[i+1]<='Z'))&&(s[i+1]!='s')&&(s[i+1]!='d'))
{syl++;
y++;
}
else if(fun(s[i-1])&&!((s[i+2]>='a'&&s[i+2]<='z')||(s[i+2]>='A'&&s[i+2]<='Z'))&&((s[i+1]=='s')||(s[i+1]=='d')))
{
syl++;y++;
}
else if(fun(s[i-1])&&!((s[i+1]>='a'&&s[i+1]<='z')||(s[i+1]>='A'&&s[i+1]<='Z')))
{
syl++;y++;
}
}
else if(!fun(s[i+1]))
{syl++;y++;
}
}
if(len<=3)
{
if(!((s[i+1]>='a'&&s[i+1]<='z')||(s[i+1]>='A'&&s[i+1]<='Z')))
{
syl++;
syl-=y;
y=0;
continue;
}
}
}
else if(s[i]==',')
{
word++;
y=0;
len=0;
}
else if(s[i]=='.' || s[i]=='?' || s[i]==':' || s[i]==';' || s[i]=='!')
{
word++;
sen++;
y=0;
len=0;
}
}
if((s[i-1]>='a'&&s[i-1]<='z')||(s[i-1]>='A'&&s[i-1]<='Z'))
{
word++;
y=0;
len=0;
}
memset(s,'\0',sizeof(s)); }
printf("%.2f\n",206.835-1.015*(double)word/(double)sen-84.6*(double)syl/(double)word);
return 0;
}
poj_3371的更多相关文章
随机推荐
- web_custom_request函数做get接口测试
最近研究了使用loadrunner做接口测试,刚开始一直不成功,后来加了QQ群,遇到大神了,经指导终于成功 下面是具体实例代码: //{"signIOS":1,"sign ...
- linux内核(五)虚拟文件系统
虚拟文件系统(VFS)是linux内核和具体I/O设备之间的封装的一层共通访问接口,通过这层接口,linux内核可以以同一的方式访问各种I/O设备. 虚拟文件系统本身是linux内核的一部分,是纯软件 ...
- hdu 5077 NAND(打表)2014 Asia regional 鞍山站 H题
题目链接:点击打开链接 题意:就是一个按位运算的一个函数.问最少经过多少步运算能够得到给定数. 思路:不是我投机取巧想打表.是特么这题仅仅能打表.. .打表思想用能够得到的数的集合表示状态bfs:最后 ...
- Hibernate中的HQL
一.查询所有的时候 List<Company> list=session.createQuery("from Company as c order by c.cid desc&q ...
- JStorm之Topology调度
topology在服务端提交过程中,会经过一系列的验证和初始化:TP结构校验.创建本地文件夹并拷贝序列化文件jar包.生成znode用于存放TP和task等信息,最后一步才进行任务分配.例如以下图 ...
- MyEclipse打包可运行的jar包
详细步骤: Export... -> java -> Runnable JAR file Launch configuration:选择main方法所在的文件/类 Export desti ...
- ORA-01733: virtual column not allowed here
基表: hr.tt scott.tt 视图1: 基于 hr.tt union all scott.tt ---> scott.ttt 视图2: 基于 视图1->scott.ttt ...
- Asp.net动态页面静态化之初始NVelocity模板引擎
Asp.net动态页面静态化之初始NVelocity模板引擎 静态页面是网页的代码都在页面中,不须要运行asp,php,jsp,.net等程序生成client网页代码的网页,静态页面网址中一般不含&q ...
- bzoj4823: [Cqoi2017]老C的方块(最小割)
4823: [Cqoi2017]老C的方块 题目:传送门 题解: 毒瘤题ORZ.... 太菜了看出来是最小割啥边都不会建...狂%大佬强强强 黑白染色?不!是四个色一起染,四层图跑最小割... 很 ...
- 文档相关命令-cat命令查看一个文件
用于查看一个文件的内容并将其显示在屏幕上 cat 后直接加上文件名 -n 表示显示行号 cat -n dirb/filee -A 显示所有内容包括特殊字符 cat -A dirb/filee