Defining Moment
Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 1660   Accepted: 760

Description

As a homework assignment, you have been tasked with creating a program that provides the meanings for many different words. As you dislike the idea of writing a program that just prints definitions of words, you decide to write a program that can print definitions of many variations of just a handful of different root words. You do this by recognizing common prefixes and suffixes. Since your program is smart enough to recognize up to one prefix and one suffix per word, it can process many forms of each word, significantly reducing the number of rote definitions required.

For this problem, you'll be writing the prefix/suffix processing portion of the program.

Valid prefixes and their meanings are:

anti<word> against <word>
post<word> after <word>
pre<word> before <word>
re<word> <word> again
un<word> not <word>

Valid suffixes and their meanings are:

<word>er one who <word>s
<word>ing to actively <word>
<word>ize change into <word>
<word>s multiple instances of <word>
<word>tion the process of <word>ing

Note that suffixes are tied more tightly to their root word and
should therefore be expanded last. For example, the word ``vaporize"
would be expanded through the following steps:

 	unvaporize

not vaporize

not change into vapor

Of course, the definitions are not exactly right, but how much polish does the professor expect for a single homework grade?

Input

Input to
this problem will begin with a line containing a single integer n
indicating the number of words to define. Each of the following n lines
will contain a single word. You need to expand at most one prefix and
one suffix, and each word is guaranteed to have a non-empty root (i.e.,
if the prefix and/or suffix are removed, a non-empty string will
remain). Each word will be composed of no more than 100 printable
characters.

Output

For each word in the input, output the expanded form of the word by replacing the prefix and/or suffix with its meaning.

Sample Input

6
vaporize
prewar
recooking
root
repopularize
uninforming

Sample Output

change into vapor
before war
to actively cook again
root
change into popular again
not to actively inform

Source

 
OJ-ID:
poj-2803
author:
Caution_X
date of submission:
20191004

tags:
模拟

description modelling:
处理至多一个前缀和后缀

major steps to solve it:
1.先处理前缀后将字符串前缀删去
2.处理后缀

AC Code:

#include<cstdio>
using namespace std;
int n,k;
int a[][];
int main()
{
//freopen("input.txt","r",stdin);
while(~scanf("%d%d",&n,&k)&&n&&k)
{
for(int i=;i<k;i++) {
for(int j=;j<n;j++) {
scanf("%d",&a[i][j]);
}
}
bool ok=false;
for(int i=;i<n;i++) {
int sum=;
for(int j=;j<k;j++) {
sum+=a[j][i];
}
if(sum==k) {
ok=true;
break;
}
}
if(ok) printf("yes\n");
else printf("no\n");
}
return ;
}

最新文章

  1. Ubuntu常用命令之update-alternatives
  2. LoadRunner --HTML/URL录制方式的选择规则
  3. 阅读DNA-2014年读书
  4. 怎么把U盘启动改为硬盘启动(适用于U盘安装系统时)
  5. loadrunner 打印变量
  6. linux 网桥的配置与实现
  7. Notepad++的一些常用的快捷键
  8. Maven工程的Web调试
  9. 10.31 afternoon
  10. android布局1
  11. 字符串匹配算法1-KMP
  12. Spring简单属性注入--不常用!!!
  13. 【ASP.NET MVC】View与Controller之间传递数据
  14. Nagle算法
  15. C#-继承(十一)
  16. 使用ssh服务管理远程主机
  17. 某大型跨境电商JVM调优总结
  18. 【使用JSOUP实现网络爬虫】修改数据-设置属性的值
  19. Junit 4.x 单元测试,参数化测试,套件测试 实例
  20. 扩展JButton实现自己的图片按钮

热门文章

  1. C++ getline函数用法详解
  2. js获取当前日期,包括星期几
  3. ABP开发框架前后端开发系列---(6)ABP基础接口处理和省份城市行政区管理模块的开发
  4. MyCat启动失败 Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: rebirth.a: rebirth.a: unknown error
  5. Java开发桌面程序学习(五)——文件选择器和目录选择器的使用
  6. Go文件内容追加问题
  7. boolean matches(String regex)正则表达式判断当前字符串是否满足格式要求
  8. [Linux] SSH隧道本地端口转发访问远程服务中的数据库
  9. 5-4 可视化库Seaborn-回归分析
  10. ts开发环境搭建