CF832B Petya and Exam
思路:
模拟。
实现:
#include <iostream>
using namespace std; string a, b;
int m, x, y, ok[]; bool solve()
{
if (y < x - ) return false;
int i = , j = ;
for (; i < x; i++, j++)
{
if (a[i] >= 'a' && a[i] <= 'z')
{
if (a[i] != b[j]) return false;
}
else if (a[i] == '?')
{
if (!ok[b[j] - 'a']) return false;
}
else
{
int tmp = j;
for (; j < tmp + y - x + ; j++)
{
if (ok[b[j] - 'a']) return false;
}
j--;
}
}
return j == y;
} int main()
{
string str;
cin >> str;
int n = str.length();
for (int i = ; i < n; i++)
{
ok[str[i] - 'a'] = ;
}
cin >> a >> m;
x = a.length();
for (int i = ; i < m; i++)
{
cin >> b;
y = b.length();
if (solve()) puts("YES");
else puts("NO");
}
return ;
}
CF832B Petya and Exam的更多相关文章
- CodeForces832-B. Petya and Exam
补的若干年以前的题目,水题,太菜啦_(:з」∠)_ B. Petya and Exam time limit per test 2 seconds memory limit per test 2 ...
- Codeforces Round #425 (Div. 2) B. Petya and Exam(字符串模拟 水)
题目链接:http://codeforces.com/contest/832/problem/B B. Petya and Exam time limit per test 2 seconds mem ...
- CodeForces 832B Petya and Exam
B. Petya and Exam time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...
- Codeforces Round #425 (Div. 2) B - Petya and Exam
地址:http://codeforces.com/contest/832/problem/B 题目: B. Petya and Exam time limit per test 2 seconds m ...
- Codefroces 832B Petya and Exam
B. Petya and Exam time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...
- E - Petya and Exam CodeForces - 832B 字典树+搜索
E - Petya and Exam CodeForces - 832B 这个题目其实可以不用字典树写,但是因为之前写过poj的一个题目,意思和这个差不多,所以就用字典树写了一遍. 代码还是很好理解的 ...
- B. Petya and Exam
B. Petya and Exam 题目链接 题意 给你一串字符,在这个串中所有出现的字符都是\(good\)字符,未出现的都是\(bad\)字符, 然后给你另一串字符,这个字符串中有两个特殊的字符, ...
- Codeforces Round #425 (Div. 2) Problem B Petya and Exam (Codeforces 832B) - 暴力
It's hard times now. Today Petya needs to score 100 points on Informatics exam. The tasks seem easy ...
- 832B Petya and Exam
题意:给你两个串,第一个串里面的字母都是good 字母, 第二个串是模式串,里面除了字母还有?和*(只有一个) ?可以替换所有good字母, *可以替换所有坏字母和空格(可以是多个坏字母!!!这点卡了 ...
随机推荐
- 如何用Bugzilla系统管理产品研发过中相关需求和bug
目 录 1.Bug处理流程及状态说明 2.bugs字段说明 3.查询报表的使用 4.bug系统与需求系统的整合 5.流程和用户权限 1. Bug处理流程及状态说明(1) BUG状态流程图 BUG的状态 ...
- Sliding Window(滑动窗口)
Time Limit: 12000MS Memory Limit: 65536K Total Submissions: 58002 Accepted: 16616 Case Time Limi ...
- PLSQL 下载地址 Spring jar包
PLSQL https://www.allroundautomations.com/ instantclient http://www.oracle.com/technetwork/topic ...
- codevs3730 无线网络发射选址
题目描述 Description 随着智能手机的日益普及,人们对无线网的需求日益增大.某城市决定对城市内的公共场所覆盖无线网. 假设该城市的布局为由严格平行的129条东西向街道和129条南北向街道所形 ...
- 11、Java并发性和多线程-Java内存模型
以下内容转自http://ifeve.com/java-memory-model-6/: Java内存模型规范了Java虚拟机与计算机内存是如何协同工作的.Java虚拟机是一个完整的计算机的一个模型, ...
- ios逆向工程
原 ios逆向工程-内部钩子(Method Swizzling) Method+Swizzling ios hook Method Swizzling(方法调配) 怎么说呢,先了解什么是钩子为什么 ...
- 应用程序无法正常启动 0xc0000013 vs2013
今天下午切换到Windows 优化代码,在debug 的时候一直出现这个问题,折腾了很久,发现原来是系统环境变量的问题,我之前装了双系统,讲原来win7 下的一块E盘删掉做了Linux 盘,而系统环境 ...
- ADT 压缩包 R23.0.0
http://pan.baidu.com/s/1qWLjs2w
- SmartSchool CC校友录V8(毕业入世版)
SmartSchool CC校友录V8(毕业入世版) 使用说明 CC校友录V8(毕业入世版) 主要面向毕业后在某城市工作的校友,给大家构建一个充分交流的平台,“人脉”积累是本软件的功能特色,为此淡化了 ...
- 初识bigdata时的一些技能小贴士
既然小豆腐如此给力,而且充分的利用主动学习的优势,已经有了迅速脑补,压倒式的优势,不过这只是表面而已,一切才刚刚开始,究竟鹿死谁手,还有待验证. 以上可以看到,小豆腐为什么拼命的要teach我们了么, ...