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. SpringMVC上传文件的三种方式(转帖)

    /* * 通过流的方式上传文件 * @RequestParam("file") 将name=file控件得到的文件封装成CommonsMultipartFile 对象 */ @Re ...

  2. Java必备主流技术流程图,写得非常好!

    作者:Jay_huaxiao https://juejin.im/post/5d214639e51d4550bf1ae8df 1.spring的生命周期 Spring作为当前Java最流行.最强大的轻 ...

  3. RabbitMq--4--集群(转载)

    RabbitMQ消息服务用户手册 1 基础知识 1.1 集群总体概述 Rabbitmq Broker集群是多个erlang节点的逻辑组,每个节点运行Rabbitmq应用,他们之间共享用户.虚拟主机.队 ...

  4. struts2之ModelDriven

    在Struts 2中,提供了另外一种直接使用领域对象的方式,就是让action实现com.opensymphony. xwork2.ModelDriven接口.ModelDriven让你可以直接操作应 ...

  5. 自编shell脚本合集(完善中)

    1.数据库备份 #!/bin/bash user="root" psword="root" bakdir="/data/mysqlbak" ...

  6. [转]图片压缩功能在JBoss AS7出错有关问题

    图片压缩功能在JBoss AS7出错问题近日在为平台(http://www.zyiqibook.com)做些小的整改,途中基本很顺利,但就在后面出现了些纠结的问题,而这问题我之前遇到过,因为一时没有想 ...

  7. 针对类别的5中softmax_cross_entropy loss计算

    # ---------------------------- #! Copyright(C) 2019 # All right reserved. # 文件名称:xxx.py # 摘 要:五种方式实现 ...

  8. 【LeetCode】Array

    [11] Container With Most Water [Medium] O(n^2)的暴力解法直接TLE. 正确的解法是Two Pointers. O(n)的复杂度.保持两个指针i,j:分别指 ...

  9. linux 出现 -bash-4.2# 问题的解决方法

    1.在根目录创建 /root 目录 mkdir /root 2. 复制 .bashrc  以及 .bash_profile俩个文件到root目录下 cp /etc/skel/.bashrc /root ...

  10. JQuery-跑马灯(文字无缝向上翻动-封装)

    转载自他人:https://blog.csdn.net/z69183787/article/details/12857587   (function($){   $.fn.extend({   &qu ...