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

poj-2803 Defining Moment的更多相关文章

  1. OpenJudge 2803 碎纸机 / Poj 1416 Shredding Company

    1.链接地址: http://poj.org/problem?id=1416 http://bailian.openjudge.cn/practice/2803 2.题目: 总时间限制: 1000ms ...

  2. Poj 1328 / OpenJudge 1328 Radar Installation

    1.Link: http://poj.org/problem?id=1328 http://bailian.openjudge.cn/practice/1328/ 2.Content: Radar I ...

  3. poj 1328 Radar Installation (简单的贪心)

    Radar Installation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 42925   Accepted: 94 ...

  4. POJ 1328 Radar Installation 贪心 A

    POJ 1328 Radar Installation https://vjudge.net/problem/POJ-1328 题目: Assume the coasting is an infini ...

  5. POJ 1577Falling Leaves(二叉树的建立)

    题目链接:http://poj.org/problem?id=1577 解题思路:题目是中文就不翻译了,网上都说这题很水,但本蒟蒻虽然知道是倒过来建立二叉搜索树,可是实现不了,得到小伙伴的关键递归思想 ...

  6. POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理

    Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798 ...

  7. POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理

    Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   ...

  8. POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治

    The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286 ...

  9. POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法

    Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 37427   Accepted: 16288 Descr ...

  10. POJ 3254. Corn Fields 状态压缩DP (入门级)

    Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9806   Accepted: 5185 Descr ...

随机推荐

  1. Redis系列---安装redis单机版02

    本章将带领大家一步一步安装Redis单机版(Redis从3.0版本后就开始支持集群了,集群将会后边章节带领大家操作) 准备环境: Centos 6.X redis3.+版本(自行下载,redis 的版 ...

  2. C# WebClient,HttpClient,WebRequest

    static void WebClientDemo() { string url = "https://www.cnblogs.com/Fred1987/p/11843418.html&qu ...

  3. 易优CMS:arcview的基础用法

    [基础用法] 名称:arcview 功能:获取单条文档数据 语法: {eyou:arcview aid='文档ID'} <a href="{$field.arcurl}"&g ...

  4. SAP MM MB5L事务代码'仅总计'选项初探

    SAP MM MB5L事务代码'仅总计'选项初探 MB5L,如下查询条件, 报表结果里显示有差异, 而如下查询条件, 原因在于当勾选了'仅总计'选项以后,系统不考虑MM以外的影响库存金额的事务,而只是 ...

  5. Linux下用户管理:创建用户指定密码

    首先我们来了解下Linux下用户管理的概念: 如上图所示,左边的一列表示用户名,中间的一列表示用户组,最右边的一列表示的是家目录.用户名我们这里处于简单就,添加了root,xm,xh三个用户.用户组和 ...

  6. Linux—系统关机命令详解

    不管是重启系统还是关闭系统,首先要运行 sync 命令,把内存中的数据写到磁盘中.将数据由内存同步写入到硬盘中. [root@localhost ~]# sync 一.shutdown命令 # 立刻关 ...

  7. fiddler---Fiddler性能测试

    从上几篇文章中我们了解到Fiddler可以帮助我们做接口测试,修改断点,抓包等应用,但是你可能想想不到,Fiddler也能做简单的性能测试 性能测试 性能测试是通过自动化的测试工具模拟多种正常.峰值以 ...

  8. 无依赖单文件http-ftp文件服务器(py2)

    网上看到的东东,居然在很合适堡垒机上传下载文件的场景. 这个只能在python2版本上跑, 我更改了自定义端口. 下次再改写个py3版本的. #!/usr/bin/env python "& ...

  9. 【cf1046】A. AI robots(动态开点线段树)

    传送门 题意: 坐标轴上有\(n\)个机器人,每个机器人带有属性\(x,r,q\),分别表示位置.可视半径以及智商. 现在定义智商相近为两个机器人的智商差的绝对值不超过$K. 现在问有多少对机器人,他 ...

  10. ffmpeg下载m3u8流媒体

    安装 编译好的windows可用版本的下载地址(官网中可以连接到这个网站,和官方网站保持同步): http://ffmpeg.zeranoe.com/builds/ 该版本为FFMPEG的Static ...