poj-2803 Defining Moment
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 1660 | Accepted: 760 |
Description
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
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
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
poj-2803
Caution_X
20191004
tags:
模拟
description modelling:
处理至多一个前缀和后缀
major steps to solve it:
1.先处理前缀后将字符串前缀删去
2.处理后缀
#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的更多相关文章
- OpenJudge 2803 碎纸机 / Poj 1416 Shredding Company
1.链接地址: http://poj.org/problem?id=1416 http://bailian.openjudge.cn/practice/2803 2.题目: 总时间限制: 1000ms ...
- Poj 1328 / OpenJudge 1328 Radar Installation
1.Link: http://poj.org/problem?id=1328 http://bailian.openjudge.cn/practice/1328/ 2.Content: Radar I ...
- poj 1328 Radar Installation (简单的贪心)
Radar Installation Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 42925 Accepted: 94 ...
- POJ 1328 Radar Installation 贪心 A
POJ 1328 Radar Installation https://vjudge.net/problem/POJ-1328 题目: Assume the coasting is an infini ...
- POJ 1577Falling Leaves(二叉树的建立)
题目链接:http://poj.org/problem?id=1577 解题思路:题目是中文就不翻译了,网上都说这题很水,但本蒟蒻虽然知道是倒过来建立二叉搜索树,可是实现不了,得到小伙伴的关键递归思想 ...
- POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理
Halloween treats Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 7644 Accepted: 2798 ...
- POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理
Find a multiple Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7192 Accepted: 3138 ...
- POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治
The Pilots Brothers' refrigerator Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 22286 ...
- POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法
Flip Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 37427 Accepted: 16288 Descr ...
- POJ 3254. Corn Fields 状态压缩DP (入门级)
Corn Fields Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 9806 Accepted: 5185 Descr ...
随机推荐
- HikariCP监控指标介绍和应用
概述 HikariCP提供了一些监控指标,他的监控指标都是基于MicroMeter提供出来的,然后支持Prometheus和Dropwizard.本次我们将讨论一下HikariCp的监控指标有哪些,为 ...
- 安装Keepalived namespaces.c:187: error: ‘SYS_setns’ undeclared (first use in this function)
错误信息 namespaces.c: In function ‘setns’: namespaces.c:: error: ‘SYS_setns’ undeclared (first use in t ...
- wpf file embeded resource is readonly,Copy always will copy the file and its folder to the bin folder
Wpf file embeded resource will compile the file into the assembly and it will be readonly and can no ...
- DevExpress 使用 GridControl 时,数据源无法立即更新的问题
背景 在使用 DevExpress 的 GridControl 为其实现 Checkbox 列,发现如果勾选了三行的数据,在遍历 GridControl 绑定的数据源时 Checkbox 列的数据仅有 ...
- go-数据结构
数据结构 数据结构(算法)的介绍 数据结构的介绍 1) 数据结构是一门研究算法的学科,只从有了编程语言也就有了数据结构.学好数据结构可以编写 出更加漂亮,更加有效率的代码. 2) 要学习好数据结构就要 ...
- VMWare虚拟机应用介绍
目录 一:VMWare简介 二:VMWare启动第一个虚拟机 一:VMWare简介 VMWare虚拟机软件是一个"虚拟PC"软件,它使你可以在一台机器上同时运行二个或更多Win ...
- Define the Data Model and Set the Initial Data 定义数据模型并设置初始数据
This topic describes how to define the business model and the business logic for WinForms and ASP.NE ...
- Javase之内部类概述
内部类概述 把类定义在其他类的内部就称为内部类 class A{ class B{ } } B就称为内部类,A称为外部类. 内部类的访问特点 内部类直接访问外部类成员,包括私有. 外部类要访问内部类要 ...
- Javase之集合体系之(1)集合顶层类Collection与其迭代器知识
集合体系之集合顶层类Collection与其迭代器知识 集合的由来:Java是一门面向对象语言,而面向对象语言对事物的描述是通过对象体现的,为了方便对多个对象进行操作,就必须把多个对象进行存储,而要存 ...
- jQuery animate() 方法
定义和用法 animate() 方法执行 CSS 属性集的自定义动画. 该方法通过 CSS 样式将元素从一个状态改变为另一个状态.CSS属性值是逐渐改变的,这样就可以创建动画效果. 只有数字值可创建动 ...