CSU 2018年12月月赛 D 2216 : Words Transformation
Description
There are n words, you have to turn them into plural form.
If a singular noun ends with ch, x, s, o, then the plural is -es. For example, witch -> witches, tomato -> tomatoes.
If a singular noun ends with f or fe, then the plural is -ves. For example, leaf -> leaves, knife -> knives. Note that f becomes v.
The noun ending with y will become -ies. For example, family -> families.
All other singular nouns are added with s. For example, book -> books.
Input
The first line, a number n, represents the number of words.
Next n lines, each line represents a word.
The number of words <= 10000, 1 <= word length <= 100.
Output
N lines.
Output the words in plural form.
Sample Input
3
contest
hero
lady
Sample Output
contests
heroes
ladies 题意:模拟题,水题,注意f,fe这块就行了。
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <math.h>
#include <set>
using namespace std;
const int maxn=;
int n;
string s;
int main()
{
scanf("%d",&n);
while(n--)
{
cin>>s;
int len=s.length();
if(s[len-]=='x'||s[len-]=='s'||s[len-]=='o'||(s[len-]=='h'&&s[len-]=='c'))
{
cout<<s<<"es"<<endl;
}
else if(s[len-]=='y')
{
for(int i=;i<len-;i++)
cout<<s[i];
cout<<"ies"<<endl;
}
else if(s[len-]=='f')
{
for(int i=;i<len-;i++)
cout<<s[i];
cout<<"ves"<<endl;
}
else if((s[len-]=='e'&&s[len-]=='f'))
{
for(int i=;i<len-;i++)
cout<<s[i];
cout<<"ves"<<endl;
}
else
cout<<s<<"s"<<endl;
}
return ;
} /**********************************************************************
Problem: 2216
User: therang
Language: C++
Result: AC
Time:420 ms
Memory:2024 kb
**********************************************************************/
CSU 2018年12月月赛 D 2216 : Words Transformation的更多相关文章
- CSU 2018年12月月赛 B 2214: Sequence Magic
Description 有一个1到N的自然数序列1,2,3,...,N-1,N. 我们对它进行M次操作,每次操作将其中连续的一段区间 [Ai,Bi][Ai,Bi] (即第Ai个元素到第Bi个元素之间的 ...
- CSU 2018年12月月赛 H(2220): Godsend
Description Leha somehow found an array consisting of n integers. Looking at it, he came up with a t ...
- CSU 2018年12月月赛 G(2219): Coin
Description 有这样一个众所周知的问题: 你面前有7个硬币,其中有一个劣质的(它比正常的硬币轻一点点),你有一个天平,问需要你需要使用天平多少次能保证找到那个劣质的硬币. 众所周知的算法是: ...
- CSU 2018年12月月赛 F(2218): Finding prime numbers
Description xrdog has a number set. There are 95 numbers in this set. They all have something in com ...
- CSU 2018年12月月赛 A 2213: Physics Exam
Description 高中物理老师总认为给学生文本形式的问题比给纯计算形式的问题要求更高.毕竟,学生首先得阅读和理解问题. 因此,他们描述一个问题不像”U=10V,I=5A,P=?”,而是”有一个含 ...
- 2018年12月8日广州.NET微软技术俱乐部活动总结
吕毅写了一篇活动总结,写得很好!原文地址是:https://blog.walterlv.com/post/december-event-microsoft-technology-salon.html ...
- [2018-11-27]2018年12月1日宁波dotnet社区线下活动
离上次活动,转眼又过了一个月,幸得各路大神支持,于本周六(12月1日),宁波dotnet社区的线下分享活动又来啦! 活动嘉宾及主题 董斌辉 2015-2019年微软全球最有价值专家(.NET方向) 2 ...
- CodePlus2017 12月月赛 div2可做题2
11月的月赛错过了,来打12月月赛,由于很(zi)想(ji)拿(tai)衣(ruo)服(la),所以去打div2. T1是一个sb模拟,但是机房全卡死在这道语文题上了,基本上弄了一个半小时,T2可以秒 ...
- web前端开发2018年12月找工作总结
2018年的冬天额外的冷,由内致外... 作为一名刚刚踏入社会的实习生,可谓是狠狠的体验了一把什么叫社会(同时也感叹父母赚钱真的很不容易) 前几天看见这样一句话"如果你不知道社会的辛苦,要么 ...
随机推荐
- HTML标签防XSS攻击过滤模块--待优化
HTML标签防XSS攻击过滤模块 http://cnodejs.org/topic/5058962f8ea56b5e7806b2a3
- Entity Framework 学习整理
MSDN: http://msdn.microsoft.com/en-us/data/aa937723 台湾博客: http://www.dotblogs.com.tw/yc421206/ http: ...
- 洛谷 P2764 最小路径覆盖问题【匈牙利算法】
经典二分图匹配问题.把每个点拆成两个,对于原图中的每一条边(i,j)连接(i,j+n),最小路径覆盖就是点数n-二分图最大匹配.方案直接顺着匹配dsf.. #include<iostream&g ...
- 洛谷P4374 [USACO18OPEN]Disruption(树链剖分+线段树)
传送门 不难发现,每一条额外修的路径,会对原树上$(u,v)$路径上的所有边产生贡献 于是这就变成了一个路径修改 那么我们把每一条边赋值到它连接的两个点中深度较大的那个上面,然后每一次用树剖+线段树做 ...
- 支持宕机自动恢复触发一次性或周期性任务执行的组件包首次介绍-easyTask
easyTask介绍 一个方便触发一次性或周期性任务执行的工具包,支持海量,高并发,高可用,宕机自动恢复任务 使用场景 需要精确到秒的某一时刻触发任务执行.比如订单交易完成24小时后如果客户未评价,则 ...
- _bzoj1208 [HNOI2004]宠物收养所【Splay】
传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1208 以后在空间限制允许的情况下我绝对不纠结内存占用问题啦!就因为不舍得用long long ...
- _bzoj3224 Tyvj 1728 普通平衡树【Splay】
传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3224 保存splay模版 一刻不停写了一个小时多一点,幸好一遍过了!(其实带着freopen ...
- Ubuntu下如何用命令运行deb安装包
转载自 WindTaiL的博客 如果ubuntu要安装新软件,已有deb安装包(例如:iptux.deb),但是无法登录到桌面环境.那该怎么安装?答案是:使用dpkg命令. dpkg命令常用格式如下: ...
- 如何用C#动态编译、执行代码[转]
原文链接 在开始之前,先熟悉几个类及部分属性.方法:CSharpCodeProvider.ICodeCompiler.CompilerParameters.CompilerResults.Assemb ...
- Android系统的启动流程
手机启动后首先会通过执行BootLoader来启动Linux内核,BootLoader是所有嵌入式设备开机启动执行的第一行代码,linux内核在启动过程中会加载各种设备的驱动同时初始化数据结构,并且开 ...