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 ...
随机推荐
- 策略路由PBR(不含track)
策略路由:是一种依据用户制定的策略进行路由选择的机制.(公义)在特定数据进入路由表前,对其进行操控的方式.(本人定义) 根据作用对象的不同,策略路由可分为本地策略路由和接口策略路由: · 本地策略路由 ...
- Python 十大装 X 语法(二)
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手.不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了.本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并 ...
- spring cloud 项目创建过程
在使用spring cloud 项目创建微服务项目时,遇到过很多坑,现在我将整理如下: 条件:Idea 开发工具 maven 项目 1. 创建一个空的mvn项目. 2. 创建完了就添加Module,首 ...
- 【linux】linux 查看物理CPU个数、核数、逻辑CPU个数
①物理cpu数:主板上实际插入的cpu数量,可以数不重复的 physical id 有几个(physical id) cat /proc/cpuinfo| grep "physical id ...
- Java8的Stream方法findAny空指针异常(NullPointerException)实例对比
实战介绍 学习完Java8的Stream方法,可能你正准备大展身手,却发现遇到不少问题,本篇文章为大家带来一个findAny方法抛出java.lang.NullPointerException的场景. ...
- requests库的使用、安装及方法的简单介绍
requests库的使用.安装及方法的简单介绍 1.requests库的概述 requests库是一个简洁且简单的处理HTTP请求的第三方库,是公认的最好获得第三方信息的库. requests库更多信 ...
- 重新认识快速视图窗体(Quick View Form)
关注本人微信和易信公众号: 微软动态CRM专家罗勇 ,回复158或者20151009可方便获取本文,同时可以在第一时间得到我发布的最新的博文信息,follow me! 在我的 微软Dynamics C ...
- 控制台程序(C#)不弹出登录窗口连接到Dynamics CRM Online的Web API
微软动态CRM专家罗勇 ,回复331或者20190505可方便获取本文,同时可以在第一间得到我发布的最新博文信息,follow me! 我之前的文章 控制台程序(C#)不弹出认证窗口连接到Dynami ...
- MD5哈希算法及其原理
- MD5功能 MD5算法对任意长度的消息输入,产生一个128位(16字节)的哈希结构输出.在处理过程中,以512位输入数据块为单位. - MD5用途及特征 MD5通常应用在以下场景: 1.防篡改,保 ...
- 使用Fiddler抓取手机HTTP流量包
- PC端配置 设置允许远程连接. - PC端共享上网 需要在PC上进行手机抓包,必须使手机流量经过PC,在文章<简单两行,实现无线WiFi共享上网,手机抓包再也不用愁了>中介绍了如何在P ...