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. 两种查看EFCore生成Sql语句的方法

    一.利用反射生成查询语句 该方法转载自:https://jhrs.com/2019/28488.html (略有修改) using Microsoft.EntityFrameworkCore.Quer ...

  2. 【随笔】CLR:向头对象(Object Header)迈进一大步!!!

    前言 在我之前一篇随笔里(戳我),我们知道,一个引用类型的对象,包含了2个额外的开销,一个是头对象(object header),一个是MT.我们接下来看看头对象到底有多神秘... Object He ...

  3. 使用 C# 实现 CJ-T188 水表协议和 DL-T645 电表协议的解析与编码

    一.协议的定义 要对某种协议进行编解码操作,就必须知道协议的基本定义,首先我们来看一下 CJ/T188 的数据帧定义(协议定义),了解请求数据与响应数据的基本结构. 1.1 CJ/T188 水表通讯协 ...

  4. Python入门36道经典练习题

    [程序1] 题目:有1.2.3.4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少? num_list=[] cou=0 for i in range(1,5): for j in rang ...

  5. centOS服务器添加电脑ssh key以支持远程登陆

    1,生成电脑的密钥对(在powershell或cmd命令行中) ssh-keygen -t rsa -C "自己的邮箱" 2.打开刚刚生成的电脑公钥(~即代表用户主目录,/则代表根 ...

  6. [转]Eclipse插件开发之基础篇(1) 插件开发的基础知识

    原文地址:http://www.cnblogs.com/liuzhuo/archive/2010/08/13/eclipse_plugin_1_0_2.html 名词翻译 有一些名词在翻译的过程中可能 ...

  7. [b0042] python 归纳 (二七)_gui_tkinter_基本使用

    # -*- coding: utf-8 -*- """ 学习 Tkinter画图基本控件使用 逻辑: 放几个 输入控件.点击按钮,将输入控件内容打印出来 使用: 1. 创 ...

  8. centOS7安装mysql8.0完美教程!!只要按照步骤,无脑操作,一次成功!

    查看防火墙systemctl status firewalld重启防火墙systemctl start firewalld 1.mysql 首先关闭防火墙 systemctl stop firewal ...

  9. 学习:SpringCloud(一)

    微服务: 微服务是一种架构模式或者一种架构风格,提倡将单一应用程序划分成一组小的服务==独立部署==,服务之间相互配合.相互协调,每个服务运行于自己的==进程==中. 服务与服务间采用轻量级通讯,如H ...

  10. [日常] gocron源码阅读-go语言的变量

    变量的声明形式是这样的 var 变量名字 类型 = 表达式var ( AppVersion = "1.5" BuildDate, GitCommit string)类型可以被省略, ...