UVa 11233 - Deli Deli
题目:求所给单词的负数形式。
分析:模拟。
直接按章题意分情况求解就可以。
说明:按语法也能够(⊙_⊙)。
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio> using namespace std; char word[22][22],maps[22][22],text[25]; int cmp(char *s, char c)
{
for (int i = 0 ; s[i] ; ++ i)
if (s[i] == c)
return 1;
return 0;
} int main()
{
int L,N;
while (cin >> L >> N) {
for (int i = 0 ; i < L ; ++ i)
cin >> word[i] >> maps[i];
for (int i = 0 ; i < N ; ++ i) {
cin >> text;
int flag = 0;
for (int j = 0 ; j < L ; ++ j)
if (!strcmp(text,word[j])) {
cout << maps[j] << endl;
flag = 1;
break;
}
if (flag) continue;
int end = strlen(text)-1;
if (end > 0 && text[end] == 'y' && !cmp("aeiou", text[end-1])) {
strcpy(&text[end],"ies");
cout << text << endl;
}else if (cmp("osx", text[end]))
cout << text << "es" << endl;
else if (end > 0 && text[end] == 'h' && cmp("cs", text[end-1]))
cout << text << "es" << endl;
else cout << text << "s" << endl;
}
}
return 0;
}
UVa 11233 - Deli Deli的更多相关文章
- HDOJ/HDU 1804 Deli Deli(英语单词复数形式~)
Problem Description Mrs. Deli is running the delicatessen store "Deli Deli". Last year Mrs ...
- js将金额专成每隔3位数加逗号
js将金额专成每隔3位数加逗号,比如 12345.00 转成 12,345.00; 懒得解释具体代码如下 //分割 String.prototype.joinByNum = function(num, ...
- 杭电ACM分类
杭电ACM分类: 1001 整数求和 水题1002 C语言实验题——两个数比较 水题1003 1.2.3.4.5... 简单题1004 渊子赛马 排序+贪心的方法归并1005 Hero In Maze ...
- Android短彩信源码解析-短信发送流程(三)
3.短信pdu的压缩与封装 相关文章: ------------------------------------------------------------- 1.短信发送上层逻辑 2.短信发送f ...
- [转]The culture name list in C#
Culture Names [C#] This example shows how to get all culture names in the .NET Framework. Use static ...
- OJ题解记录计划
容错声明: ①题目选自https://acm.ecnu.edu.cn/,不再检查题目删改情况 ②所有代码仅代表个人AC提交,不保证解法无误 E0001 A+B Problem First AC: 2 ...
- 转载:hdu 题目分类 (侵删)
转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...
- uva 1354 Mobile Computing ——yhx
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABGcAAANuCAYAAAC7f2QuAAAgAElEQVR4nOy9XUhjWbo3vu72RRgkF5
- UVA 10564 Paths through the Hourglass[DP 打印]
UVA - 10564 Paths through the Hourglass 题意: 要求从第一层走到最下面一层,只能往左下或右下走 问有多少条路径之和刚好等于S? 如果有的话,输出字典序最小的路径 ...
随机推荐
- DH11数字温湿度传感器
DH11数字温湿度传感器是一种集温度.湿度一体的复合传感器,它能把温度和湿度物理量通过温.湿度敏感元件和相应电路转化成方便计算机.PLC.智能仪表等数据采集设备直接读取的数字量.DHT11由电阻式感湿 ...
- UISearchBar控件
摘自:http://blog.sina.com.cn/s/blog_7b9d64af0101dfg8.html UISearchBar控件就是要为你完成搜索功能的一个专用控件.它集成了很多你意想不到的 ...
- char s[]字串和char *s字串有什麼区别?
C語言有兩種字串宣告方式char s[]和char *s,兩者有什麼差異呢? Introduction char s[] = "Hello World"; (只是用字符串常量初始化 ...
- 基于visual Studio2013解决C语言竞赛题之0903文件读写
题目
- Android-onInterceptTouchEvent()和onTouchEvent()总结
老实说,这两个小东东实在是太麻烦了,很不好懂,我自己那api文档都头晕,在网上找到很多资料,才知道是怎么回事,这里总结一下,记住这个原则就会很清楚了: 1.onInterceptTouchEvent( ...
- android内存的一点优化
android手机给应用分配的内存通常是8兆左右,如果处理内存处理不当很容易造成OutOfMemoryError,我们的产品出现最多的错误也是OutOfMemoryError的异常, 在解决这个异常时 ...
- itextSharp 使用模板(PdfTemplate)不规则分栏(ColumnText)
public static void Main() { Document document = new Document(); BaseFont bf = BaseFont.createFont(Ba ...
- vim: vim快捷键
0. 搜索字符串: 精确匹配查找单词 如果你输入 "/the",你也可能找到 "there". 要找到以 "the" 结尾的单词,可以用:/ ...
- Python爬虫入门三之Urllib库的基本使用
转自http://cuiqingcai.com/947.html 1.分分钟扒一个网页下来 怎样扒网页呢?其实就是根据URL来获取它的网页信息,虽然我们在浏览器中看到的是一幅幅优美的画面,但是其实是由 ...
- Qt控件精讲一:按钮
原地址:http://blog.csdn.net/yuxikuo_1/article/details/17397109 Qt Creater提供6种Button控件.如图1. Button控件介绍 控 ...