BZOJ——1622: [Usaco2008 Open]Word Power 名字的能量
http://www.lydsy.com/JudgeOnline/problem.php?id=1622
Description
Input
Output
Sample Input
Bessie
Jonathan
Montgomery
Alicia
Angola
se
nGo
Ont
INPUT DETAILS:
There are 5 cows, and their names are "Bessie", "Jonathan",
"Montgomery", "Alicia", and "Angola". The 3 good strings are "se",
"nGo", and "Ont".
Sample Output
1
2
0
1
OUTPUT DETAILS:
"Bessie" contains "se", "Jonathan" contains "Ont", "Montgomery" contains
both "nGo" and "Ont", Alicia contains none of the good strings, and
"Angola" contains "nGo".
HINT
Source
#include <cstring>
#include <cstdio> const int N();
char name[N][N];
int n,m,ans[N]; inline void Get(char *s)
{
int len=strlen(s);
for(int i=; i<n; ++i)
{
int k=,L=strlen(name[i]);
for(int j=; j<L; ++j)
{
if((name[i][j]-s[k]==)||name[i][j]==s[k]||
(s[k]-name[i][j]==)) k++;
if(k==len) { ans[i]++; break; }
}
}
} int Presist()
{
scanf("%d%d",&n,&m);
for(int i=; i<n; ++i)
scanf("%s",name[i]);
for(char s[N]; m--; )
scanf("%s",s),Get(s);
for(int i=; i<n; ++i)
printf("%d\n",ans[i]);
return ;
} int Aptal=Presist();
int main(int argc,char**argv){;}
BZOJ——1622: [Usaco2008 Open]Word Power 名字的能量的更多相关文章
- BZOJ 1622: [Usaco2008 Open]Word Power 名字的能量
题目 1622: [Usaco2008 Open]Word Power 名字的能量 Time Limit: 5 Sec Memory Limit: 64 MB Submit: 349 Solved ...
- bzoj 1622: [Usaco2008 Open]Word Power 名字的能量【模拟】
模拟即可,注意包含可以是不连续的 方便起见读入的时候全转成小写 #include<iostream> #include<cstdio> using namespace std; ...
- 1622: [Usaco2008 Open]Word Power 名字的能量
1622: [Usaco2008 Open]Word Power 名字的能量 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 370 Solved: 18 ...
- 【BZOJ】1622: [Usaco2008 Open]Word Power 名字的能量(dp/-模拟)
http://www.lydsy.com/JudgeOnline/problem.php?id=1622 这题我搜的题解是dp,我也觉得是dp,但是好像比模拟慢啊!!!! 1400ms不科学! 设f[ ...
- [Usaco2008 Open]Word Power 名字的能量
1622: [Usaco2008 Open]Word Power 名字的能量 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 408 Solved: 19 ...
- bzoj1622 [Usaco2008 Open]Word Power 名字的能量
Description 约翰想要计算他那N(1≤N≤1000)只奶牛的名字的能量.每只奶牛的名字由不超过1000个字待构成,没有一个名字是空字体串, 约翰有一张“能量字符串表”,上面有M(1 ...
- BZOJ_1622_[Usaco2008_Open]_Word_Power_名字的能量_(字符匹配_暴力)
描述 http://www.lydsy.com/JudgeOnline/problem.php?id=1622 给出多个文本串和模式串,求每个文本串中有多少模式串. 分析 直接暴力... #inclu ...
- 洛谷——P2908 [USACO08OPEN]文字的力量Word Power
P2908 [USACO08OPEN]文字的力量Word Power 题目描述 Farmer John wants to evaluate the quality of the names of hi ...
- 洛谷 P2908 [USACO08OPEN]文字的力量Word Power
P2908 [USACO08OPEN]文字的力量Word Power 题目描述 Farmer John wants to evaluate the quality of the names of hi ...
随机推荐
- thinkphp5开发restful-api接口学习 笔记二
目录 第4节 为api项目搭建数据库 第5节 使用markdown书写接口文档 第6节(判断数据库中是否有此用户) 第7节 为项目配置URL 需求分析 配置主域名和二级域名 使用tp5路由进行URL解 ...
- Java-framework-Vaadin
安装vaadin: (1) 首先试了maven+vaadin. 安装maven: 1. unzip apache-maven-3.3.9-bin.zip 2. modify PATH environm ...
- static 的三个作用
1).用于声明函数体内的变量为静态局部变量,存储在静态数据存储区,在函数被调用过程中维持其值保持不变 2).在文件内(函数体外)被声明为静态的变量,可以被文件内的所有函数访问,但不能被其他文件的函数访 ...
- viewController备注
1.按结构可以对iOS的所有ViewController分成两类: 1).主要用于展示内容的ViewController,这种ViewController主要用于为用户展示内容,并与用户交互,如UIT ...
- HDU - 1496 Equations (hash)
题意: 多组测试数据. 每组数据有一个方程 a*x1^2 + b*x2^2 + c*x3^2 + d*x4^2 = 0,方程中四个未知数 x1, x2, x3, x4 ∈ [-100, 100], 且 ...
- Linux学习-延伸正则表达式
grep 默认仅支持基础正则表达式,如果要使用延伸型正则 表达式,你可以使用 grep -E , 不过更建议直接使用 egrep !直接区分指令比较好记忆!其 实 egrep 与 grep -E 是类 ...
- Linux学习-仅执行一次的工作排程
atd 的启动与 at 运作的方式 要使用单一工作排程时,我们的 Linux 系统上面必须要有负责这个排程的服务,那就是 atd 这个玩 意儿. 不过并非所有的 Linux distributions ...
- matlab callback 数据传递
M文件中内的每个Callback都可以视为一个独立的可执行的接口,因此,任一个Callback触发后所执行的运算值若要在其他Callback中使用,就无法与MATLAB工作空间内的变量继续执行操作,也 ...
- 【12】Firefox 快捷键大全及更改和定制快捷键的方法
[12]Firefox 快捷键大全及更改和定制快捷键的方法 答: Firefox 本身没有提供更改和定制快捷键的选项,若有需要,请安装扩展 Keyconfig 来解决. 安装地址如下: Keycon ...
- oracle 可以连接数据库,vs连不上. 报错提示:ORA-12154: TNS: 无法解析指定的连接标识符
方法1:问题:VS 连接 Data Source=ORCL_Service19;User Id=*;Password=* 连接不上 oracle 可以连接数据库,vs连不上,报错提示:ORA-1215 ...