Deli Deli

Time Limit: 1000MS Memory limit: 65536K

题目描述

Mrs. Deli is running the delicatessen store "Deli Deli". Last year Mrs. Deli has decided to expand her business and build up an online store. She has hired a programmer who has implemented the online store.

Recently some of her new online customers complained about the electronic bills. The programmer had forgotten to use the plural form in case that an item is purchased multiple times. Unfortunaly the programmer of Mrs. Deli is on holiday and now it is your task to implement this feature for Mrs. Deli. Here is a description how to make the plural form:

  1. If the word is in the list of irregular words replace it with the given plural.
  2. Else if the word ends in a consonant followed by "y", replace "y" with "ies".
  3. Else if the word ends in "o", "s", "ch", "sh" or "x", append "es" to the word.
  4. Else append "s" to the word.

输入

The first line of the input file consists of two integers L and N (0 ≤ L ≤ 201 ≤ N ≤ 100). The following L lines contain the description of the irregular words and their plural form. Each line consists of two words separated by a space character, where the first word is the singular, the second word the plural form of some irregular word. After the list of irregular words, the following N lines contain one word each, which you have to make plural. You may assume that each word consists of at most 20 lowercase letters from the english alphabet (\'a\' to \'z\').

输出

Print N lines of output, where the ith line is the plural form of the ith input word.

示例输入

3 7
rice rice
spaghetti spaghetti
octopus octopi
rice
lobster
spaghetti
strawberry
octopus
peach
turkey

示例输出

rice
lobsters
spaghetti
strawberries
octopi
peaches
turkeys

字符串的处理,注意看清题意!!!

代码:

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct node
{
 char a[100];
 char b[100];
}str[25];

char str1[105];
int main()
{
 int n,m;
 int i,j,k;
 int len;
 scanf("%d%d",&n,&m); 
 for(i=0;i<n;i++)
 {
  scanf("%s%s",str[i].a,str[i].b);  
 }
 for(i=0;i<m;i++)
 {
  //memset(str1,0,sizeof(str1));
  scanf("%s",str1);  
  len=strlen(str1);
  for(j=0;j<n;j++)
  {
   if(strcmp(str1,str[j].a)==0)
   {
    printf("%s\n",str[j].b);
    break;
   }   
    
  }
  if(j>=n)
  {
   if(str1[len-1]=='y'&&str1[len-2]!='a'&&str1[len-2]!='e'&&str1[len-2]!='i'&&str1[len-2]!='o'&&str1[len-2]!='u')//注意这地方啊!!
   {
    for(k=0;k<len-1;k++)
      printf("%c",str1[k]);    
    printf("ies\n");
    
   }
   else if(str1[len-1]=='o'||str1[len-1]=='s'||str1[len-1]=='x'||(str1[len-1]=='h'&&(str1[len-2]=='s'||str1[len-2]=='c')))
   {
    printf("%s",str1);
    printf("es\n");
    
   }
   else
   {
    printf("%s",str1);
    printf("s\n");
    
   }
  }

}
 return 0;
}

内部赛nbsp;3nbsp;Dnbsp;Delinbsp;Deli相关推荐

  1. decode判断不为空拼接_空指针4月内部赛官方WP

    本次内部赛含WEB跟RE题目各一道,其中RE题目7人解出,WEB题目1人解出,恭喜以上选手. 下面放上本次内部赛的WP. RE题目由于前几次的空指针题目太难了,所以这次出了一道较为简单的题(要不然每次 ...

  2. [PWNHUB 2022 5月公开赛内部赛web部分]

    1NDEX 0x00 前言 公开赛 Templateplay 看看官方的wp MyNotes php session序列化机制 brain.md 内部赛 MockingMail 反思 0x01 ret ...

  3. PWNHUB 五月公开赛+内部赛 writeup(【5月公开赛】MyNotes TemplatePlay 【胖哈勃内部赛|五月,你好】MockingMail)

    PWNHUB 五月公开赛+内部赛 writeup [5月公开赛]MyNotes [5月公开赛]TemplatePlay [胖哈勃内部赛|五月,你好!]MockingMail [胖哈勃内部赛|五月,你好 ...

  4. XMCTF内部赛 part1

    web3-考核 <?php highlight_file(__FILE__); $content = @$_GET['content'] ? "---mylocalnote---\n& ...

  5. 京东JData算法大赛小结(公司内部赛)

    总体解决方案 本文将高潜用户购买意向预测,抽象为一个二分类问题.从用户,商品,品牌,用户-商品,用户-品牌五个维度进行特征提取.将观察天未来5天有购买行为的用户-商品对标记为正样本,观察天过去30天至 ...

  6. PWN-PRACTICE-CTFSHOW-3

    PWN-PRACTICE-CTFSHOW-3 pwn10 萌新赛-签到题 萌新赛-数学99 内部赛-签到题 pwn10 格式化字符串漏洞,覆写num为16即可打印出flag # -*- coding: ...

  7. CTF比赛PWN题sgtlibc通用快速解题框架

    CTF比赛PWN题sgtlibc通用快速解题框架 安装 开源地址:https://github.com/serfend/sgtlibc 使用 pip install sgtlibc -U 安装pwn解 ...

  8. 阿里巴巴大数据竞赛(2014年3月10日到11月)

    大赛简介 阿里巴巴大数据竞赛是阿里巴巴集团主办,在阿里巴巴大数据科研平台--"天池"上开展的,基于天猫海量真实用户的访问数据的推荐算法大赛. 本次比赛的目的是让广大的高校同学在大数 ...

  9. 大数据工程师需要哪些基础知识?

    大数据是眼下非常时髦的技术名词,与此同时自然也催生出了一些与大数据处理相关的职业,通过对数据的挖掘分析来影响企业的商业决策. 这群人在国外被叫做数据科学家(Data Scientist),这个头衔最早 ...

最新文章

  1. 矩阵消除游戏--牛客练习赛58
  2. 算法-判断是否是完全二叉树
  3. CentOS6实现路由器功能
  4. 时间处理:计算下一天日期,如输入2004/12/31(注释2014年12月31日),则输出2005/1/1....
  5. Android P (4)一种绕过Android P上非SDK接口限制的简单方法
  6. windows下socket编程GetLastError()函数返回结果与对照表-转
  7. Android Webview 设置Cookie问题
  8. 小情调的伤感空间日志分享:亲爱的、你还不懂么?
  9. MIPI-DSI 三种 Video Mode 理解
  10. VS项目下写.bat脚本清理中间文件,减少内存空间
  11. 基于Python的“书怡”在线书店系统的设计与实现毕业设计源码082332
  12. 签约沈腾、贾玲,苏宁拼购打造下沉市场“新引擎”
  13. openocd Win10安装jlink->winUSB失败
  14. GlobalCash全球付万事达虚拟信用卡-可用于国外支付购物
  15. PYTHON3 Modbus_tk
  16. DO - varying
  17. 【机器学习】GMM模型的直观推导(含中间步骤)
  18. Docker 搭建 EK 环境
  19. 平安产险深圳分公司:邓斌出任中国平安首席投资执行官 夯实投管体系和能力建设
  20. linux 安装宝塔及配置关关采集(完整过程介绍)

热门文章

  1. [intervention/image]操作图片从未如此简单
  2. ValueError: Expected 2D array, got 1D array instead: 的解决办法
  3. web(四) 表格与合并单元格
  4. windows10每次新建文件夹都需要赋予管理员权限问题
  5. 企业最佳Node.js 应用案例分享
  6. python 谷歌登录_使用Python登录Google帐户进入网站
  7. 简单描述什么是hadoop?
  8. qt中打印函数QDebug的执行时间是多少呢?
  9. python中字节的介绍
  10. 浏览器大厂将停止支持TLS 1.0/1.1的HTTPS网站