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 ...
随机推荐
- angular 前端路由不生效解决方案
angular 前端路由不生效解决方案 Intro 最近使用 Angular 为我的活动室预约项目开发一个前后端分离的客户端,在部署上遇到了一个问题,前端路由不生效,这里记录一下.本地开发正常,但是部 ...
- Java电商项目-3.使用VSFTPD_Nginx完成商品新增
目录 到Github获取源码请点击此处 一. 商品类目查询 二. FTP图片服务器的搭建 图片上传思路介绍 Linux中安装vsftpd 接着配置ftp服务, 让外网可以访问 Http服务器搭建 Ng ...
- c#中xml增删查改
/// <summary> /// xml转list /// </summary> /// <typeparam name="T">目标对象&l ...
- C# WinForm实现禁止最大化、最小化、双击标题栏、双击图标等操作
protected override void WndProc(ref Message m) { if (m.Msg==0x112) { switch ((int) m.WParam) { //禁止双 ...
- Java的23种设计模式,详细讲解(一)
本人免费整理了Java高级资料,涵盖了Java.Redis.MongoDB.MySQL.Zookeeper.Spring Cloud.Dubbo高并发分布式等教程,一共30G,需要自己领取.传送门:h ...
- Spring框架教程IDEA版-----更新中
补充:设计模式中的工厂模式 设计模式党的主要原则:(1)对接口编程,而不是对实现编程 (2)优先使用对象组合而不是继承 在实现接口的方法时: @Override是伪代码,表示重写.(当然不写@Over ...
- java核心技术第六篇之断言、日志、包装类型和工具类
JDK1.5新特性: 1.自动拆装箱. 2.泛型 3.可变参数 4.静态导入 5.增强for循环 6.互斥锁 7.枚举 8.注解 JDK1.6新特性: 1.Desktop类和SystemTray类 2 ...
- Asp.net MVC 中的TempData对象的剖析
另一篇文章,也对TempData 做了很详细的介绍,链接地址:https://www.jianshu.com/p/eb7a301bc536 . MVC中的 TempData 可以在Controll ...
- 2-2-for循环
重复执行某些代码 每次执行的时候有个数字在变化 常用格式 <script> for(var i=0; i<3; i++){alert(i); } </script> 1) ...
- 74HC238引脚定义 使用方法
三八译码器 用作IO扩展与复用 用3个IO,可以控制8个输出 引脚定义 A0~A2:3个输入 E1.E2:拉低使能,可以接地 E3:拉高使能,可以接VCC Y0~Y7:8个输出 真值表 如果想输出8个 ...