zoukankan      html  css  js  c++  java
  • UVa 11233

    题目:求所给单词的负数形式。

    分析:模拟。

    直接按章题意分情况求解就可以。

    说明:按语法也能够(⊙_⊙)。

    #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;
    }
    

  • 相关阅读:
    AJAX补充
    JQuery知识补充2
    JQuery知识补充1
    LiveBOS使用指南
    HTML5(1)
    .net 后台导出excel ,word
    Eval绑定方法:多条件绑定:
    repeater 的用法
    两个页面地址栏传值
    js取后台的值
  • 原文地址:https://www.cnblogs.com/blfshiye/p/5070400.html
Copyright © 2011-2022 走看看