Go Latin

题目描述

There are English words that you want to translate them into pseudo-Latin. To change an English word into pseudo-Latin word, you simply change the end of the English word like the following table.

点此查看图片

If a word is not ended as it stated in the table, put ‘-us’ at the end of the word. For example, a word “cup” is translated into “cupus” and a word “water” is translated into “wateres”.

Write a program that translates English words into pseudo-Latin words.

输入

Your program is to read from standard input. The input starts with a line containing an integer, n (1 ≤ n ≤ 20), where n is the number of English words. In the following n lines, each line contains an English word. Words use only lowercase alphabet letters and each word contains at least 3 and at most 30 letters.

输出

Your program is to write to standard output. For an English word, print exactly one pseudo-Latin word in a line.

样例输入

2
toy
engine

样例输出

toios
engianes

题解

签到模拟

代码

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define memset(x,y) memset(x,y,sizeof(x))
#define memcpy(x,y) memcpy(x,y,sizeof(y))
#define all(x) x.begin(),x.end()
#define readc(x) scanf("%c",&x)
#define read(x) scanf("%d",&x)
#define read2(x,y) scanf("%d%d",&x,&y)
#define read3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define print(x) printf("%d\n",x)
#define lowbit(x) x&-x
#define lson(x) x<<1
#define rson(x) x<<1|1
#define pb push_back
#define mp make_pair
typedef pair<int,int> P;
typedef long long LL;
typedef long long ll;
const double eps=1e-8;
const double PI = acos(1.0);
const int INF = 0x3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int MOD = 1e9+7;
const ll mod = 998244353;
const int MAXN = 1e6+7;
const int maxm = 1;
const int maxn = 100000+10;
int T;
int n,m;
//char s[100];
string s;
char temp[100];
char cls[500][500];
string dd; int main(){
cin >> n;
while(n--){
cin >> s;
int len = s.length();
if(s[len-1] == 'a') s+='s';
else if(s[len-1] == 'i' ) {
s +="os";
}
else if(s[len-1] == 'y' ) {
s[len - 1] = 'i';
s += "os";
}
else if(s[len-1] == 'l' ) {
s +="es";
}
else if(s[len-1] == 'o' ) {
s +="s";
}
else if(s[len-1] == 'r' ) {
s +="es";
}
else if(s[len-1] == 'v' ) {
s +="es";
}
else if(s[len-1] == 'w' ) {
s +="as";
}
else if(s[len-1] == 't' ) {
s +="as";
}
else if(s[len-1] == 'u' ) {
s += 's';
}
else if(s[len-1] == 'n' ) {
s[len-1] = 'a';
s +="nes";
}
else if(s[len-2] == 'n' && s[len-1] =='e' ) {
s[len-2] = 'a';
s[len-1] = 'n';
s +="es";
}
else {
s+="us";
}
cout << s<<endl;
}
}

upc组队赛4 Go Latin的更多相关文章

  1. upc组队赛3 Chaarshanbegaan at Cafebazaar

    Chaarshanbegaan at Cafebazaar 题目链接 http://icpc.upc.edu.cn/problem.php?cid=1618&pid=1 题目描述 Chaars ...

  2. upc组队赛1 过分的谜题【找规律】

    过分的谜题 题目描述 2060年是云南中医学院的百年校庆,于是学生会的同学们搞了一个连续猜谜活动:共有10个谜题,现在告诉所有人第一个谜题,每个谜题的答案就是下一个谜题的线索....成功破解最后一个谜 ...

  3. upc组队赛1 不存在的泳池【GCD】

    不存在的泳池 题目描述 小w是云南中医学院的同学,有一天他看到了学校的百度百科介绍: 截止到2014年5月,云南中医学院图书馆纸本藏书74.8457万册,纸质期刊388种,馆藏线装古籍图书1.8万册, ...

  4. upc组队赛1 黑暗意志【stl-map】

    黑暗意志 题目描述 在数千年前潘达利亚从卡利姆多分离之时,迷雾笼罩着这块新形成的大陆,使它不被外来者发现.迷雾同样遮蔽着这片大陆古老邪恶的要塞--雷神的雷电王座.在雷神统治时期,他的要塞就是雷电之王力 ...

  5. upc组队赛1 闪闪发光 【优先队列】

    闪闪发光 题目描述 一所位于云南昆明的中医药本科院校--云南中医学院. 因为报考某专业的人数骤减,正面临着停招的危机. 其中有九名少女想到一条妙计--成为偶像, 只要她们成为偶像,学校的名气便会增加, ...

  6. upc组队赛1 流连人间的苏苏

    流连人间的苏苏 题目描述 苏苏在做红尘仙的任务时,发现坐落于风景秀丽.四季如春的昆明市的云南中医学院. 没过多久,苏苏就喜欢上了这个学校.以致于苏苏忘了回涂山的时间,现在她只剩下d天的时间待在云南中医 ...

  7. upc组队赛18 THE WORLD【时间模拟】

    THE WORLD 题目链接 题目描述 The World can indicate world travel, particularly on a large scale. You mau be l ...

  8. upc 组队赛18 STRENGTH【贪心模拟】

    STRENGTH 题目链接 题目描述 Strength gives you the confidence within yourself to overcome any fears, challeng ...

  9. upc组队赛17 Stone Game【极小值】

    Stone Game 题目链接 题目描述 Alice and Bob are always playing game! The game today is about taking out stone ...

随机推荐

  1. 判断是否是NaN

    if (isNaN(parseInt(x))) { alert("非数字"); } else{ alert("数字"); }

  2. web测试点

    一.输入框 1.字符型输入框: (1)字符型输入框:英文全角.英文半角.数字.空或者空格.特殊字符“~!@#¥%……&*?[]{}”特别要注意单引号和&符号. 禁止直接输入特殊字符时, ...

  3. Linux查看大文件日志

    Linux 查看大日志文件1.使用 less 命令 less filename 但是使用上述命令的坏处是,默认打开的位置在第一行,并且当切换到实时滚动模式(按 F ,实现效果类似 tail -f 效果 ...

  4. cpupower:Shows and sets processor power related values

    软件包: * sys-power/cpupower Latest version available: Latest version installed: Size of files: KiB Hom ...

  5. Eclipse插件pydev编辑.py文件时报错:unresolved import error.解决办法

    在同一个包中import还报unresolved import error.感觉很奇怪,原来需要把当前的包也要添加到System libs中  

  6. python面试题之有没有一个工具可以帮助查找python的bug和进行静态的代码分析?

    pycheck pylint 本文首发于python黑洞网,博客园同步更新

  7. [Fw]初探linux中断系统(1)

    1. 重要接口 LDD上说,“内核维护了一个中断信号线的注册表,该注册表类似于I/O端口的注册表.模块在使用中断前要先请求一个中断通道(或者中断请求IRQ),然后在使用后释放该通道.” 撇开系统如何遍 ...

  8. ARM与Cortex

    arm系列从arm11开始,以后的就命名为cortex,并且性能上大幅度提升. 从cortex开始,分为三个系列,a系列,r系列,m系列. m系列与arm7相似,不能跑操作系统(只能跑ucos2),偏 ...

  9. C#@字符的使用

    一,在字符串中的使用 //当在字符串前面加上一个@字符的时候,我们就可以把一个字符串定义在多行 // 编译器不会再去识别字符串中的转义字符 // 如果需要在字符串中表示一个双引号的话,需要使用两个双引 ...

  10. Python 的PIL,可以解决ImportError The _imagingft C module is not installed

    删除PIL相关文件 mv PIL /tmp   pip install Pillow 安装Pillow后, 可能还会发生KeyError的错误, 检查项目源码后发现是 Image 模块的save函数中 ...