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年的冬天额外的冷,由内致外... 作为一名刚刚踏入社会的实习生,可谓是狠狠的体验了一把什么叫社会(同时也感叹父母赚钱真的很不容易) 前几天看见这样一句话"如果你不知道社会的辛苦,要么 ...
随机推荐
- Jquery 之deferred
一.概述 在jquery中有种对象称之为延时对象,可以由 http请求方法$.get(), $.ajax(), $.post() 产生, 内置方法如下 也可以有jquery的延时方法 $.when( ...
- 关于kindle无法连接上wifi的问题
家里换了宽带以后我发现kindle无法链接上WiFi了. 原因可能是我家使用的WiFi网络是1-11之间的信道,也有可能是运营商的问题(由于我是软件开发,对硬件和网络并不是很清楚,只能大概估计一下). ...
- bzoj 2743: [HEOI2012]采花【树状数组】
离线,按照l排序 注意到在区间里出现两次的颜色才有贡献,所以记录一个ne[i]表示i后第一个和i同色的花,维护一个l,每次处理询问的时候l单调右移,树状数组维护,在ne[ne[i]]位置++,在ne[ ...
- 如何实现Docker镜像和容器实例的备份迁移
题记 大家在使用Docker都会从容器仓库下载镜像,不过这个过程可能依据网络带宽而定,那么如果将一个已经下载好的镜像迁移到另外一个环境中,或者说如何实现Docker容器的备份恢复,或者迁移,接下来我们 ...
- 【css】rem及其替换方案
移动端的web前端开发其实经常会有一些令人头疼的问题,比如屏幕适配.1像素问题等,rem也是之前在屏幕适配上比较完善的一套方案,但是随着业务的深入,任何方案都有其优秀与不足的地方,rem这套方案也一样 ...
- Android推送服务(1)几种实现方式
1.几种常见的解决方案实现原理 1)轮询(Pull)方式:应用程序应当阶段性的与服务器进行连接并查询是否有新的消息到达,你必须自己实现与服务器之间的通信,例如消息排队等.而且你还要考虑轮询的频率,如果 ...
- Android上的线程安全
Thread-safe methods In some situations, the methods you implement might be called from more than one ...
- 总结用CoreText绘制文本时遇到的问题以及解决办法
关于CoreText不做解释.用的人自然知道这个是干什么的. 功能非常强大,可以绘制文本,图片等. 这次用的Xcode7.0的版本.所以之前很多方法,现在不能用.也不是不能用,就是有黄色警告很不爽. ...
- Normal equations 正规方程组
前面我们通过Gradient Descent的方法进行了线性回归,但是梯度下降有如下特点: (1)需要预先选定Learning rate: (2)需要多次iteration: (3)需要Feature ...
- 459 Repeated Substring Pattern 重复的子字符串
给定一个非空的字符串,判断它是否可以由它的一个子串重复多次构成.给定的字符串只含有小写英文字母,并且长度不超过10000.示例 1:输入: "abab"输出: True解释: 可由 ...