zoukankan      html  css  js  c++  java
  • upc组队赛4 Go Latin

    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
    ",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;
      }
    }
    
  • 相关阅读:
    CKA&CKAD考试
    进程线程和协程
    HTTP协议
    Centos操作系统启动流程
    高并发下的Linux内核参数优化
    DDoS防护系统建设的一些思路
    DDoS防护实现概述
    Nginx故障排查思路
    git常用指令集
    DNS实现粗粒度容灾
  • 原文地址:https://www.cnblogs.com/llke/p/10799958.html
Copyright © 2011-2022 走看看