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 ...
随机推荐
- Spring Boot快速集成kaptcha生成验证码
Kaptcha是一个非常实用的验证码生成工具,可以通过配置生成多样化的验证码,以图片的形式显示,从而无法进行复制粘贴:下面将详细介绍下Spring Boot快速集成kaptcha生成验证码的过程. 本 ...
- 抖音美女千千万,想用Python爬爬看
前言 文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理. 作者: 星安果.AirPython PS:如有需要Python学习资料的小伙 ...
- python-execjs(调用js)
一.安装 pip3 install PyExecJS 电脑上要有nodejs环境 二.使用 一.获取js字符串 首先将js保存至于本地文件或者你可以可以直接读到内存,必须让js以字符串的形式展示 注意 ...
- 获取给定地址中的域名,substring()截取
package seday01;/** * 获取给定地址中的域名 * @author xingsir */public class Test { public static void main(Str ...
- Java生鲜电商平台-深刻理解电商的库存架构与解决方案
Java生鲜电商平台-深刻理解电商的库存架构与解决方案 说明:一般电商的库存都是跟SKU相关联的,那么怎么样才能进行SKU的库存管理呢?有以下几种方式与方法: 一.七大库存分类 首先得学习什么是库存, ...
- Netty与RPC
一.Netty原理 Netty是一个高性能.异步事件驱动的NIO框架,基于Java NIO提供的API实现.它提供了对TCP.UDP和文件传输的支持,作为一个异步NIO框架,Netty的所有IO操作都 ...
- VUE组内培训
最近去参加了一个外部VUE的周末培训,加上自己比较感兴趣所以对这项很热的前端框架做了点学习,顺便给组内同事做个简单的分享,希望下次有项目可以使用上- VUE的语法教程网上很多我就不一一列举,截图放一下 ...
- Xcode里面如何添加和配置pch文件??
开发工具/原料: 1.Mac 2.Xcode(我这里目前用的Xcode的最新版本Xcode 7.3) PCH文件的部分发展史: 定义:pch全称为“precompiled header”,也就是预编译 ...
- curl http libcurl 功能使用
/* * This example shows a HTTP PUT operation. PUTs a file given as a command * line argument to the ...
- 【Gradle】Gradle构建脚本基础
Gradle构建脚本基础 Settings文件 在Gradle中,定义了一个设置文件,用于初始化以及工程树的配置.设置文件的默认名为settings.gradle,放在根工程目录下. 设置文件大多数的 ...