#425

Matlab Robotics Toolbox实战:四自由度机械臂建模与仿真全流程(附代码) 本文详细介绍了使用Matlab Robotics Toolbox进行四自由度机械臂建模与仿真的全流程,包括DH参数定义、模型构建、可视化、运动学仿真及交互控制。通过实战案例和代码示例,帮助读者快速掌握机械臂建模技巧,提升机器人学习效率。 阅读详情

B. Petya and Exam

It’s hard times now. Today Petya needs to score 100 points on Informatics exam. The tasks seem easy to Petya, but he thinks he lacks time to finish them all, so he asks you to help with one..

There is a glob pattern in the statements (a string consisting of lowercase English letters, characters “?” and ““). It is known that character “” occurs no more than once in the pattern.

Also, n query strings are given, it is required to determine for each of them if the pattern matches it or not.

Everything seemed easy to Petya, but then he discovered that the special pattern characters differ from their usual meaning.

A pattern matches a string if it is possible to replace each character “?” with one good lowercase English letter, and the character “*” (if there is one) with any, including empty, string of bad lowercase English letters, so that the resulting string is the same as the given string.

The good letters are given to Petya. All the others are bad.

Input
The first line contains a string with length from 1 to 26 consisting of distinct lowercase English letters. These letters are good letters, all the others are bad.

The second line contains the pattern — a string s of lowercase English letters, characters “?” and “” (1 ≤ |s| ≤ 105). It is guaranteed that character “” occurs in s no more than once.

The third line contains integer n (1 ≤ n ≤ 105) — the number of query strings.

n lines follow, each of them contains single non-empty string consisting of lowercase English letters — a query string.

It is guaranteed that the total length of all query strings is not greater than 105.

Output
Print n lines: in the i-th of them print “YES” if the pattern matches the i-th query string, and “NO” otherwise.

You can choose the case (lower or upper) for each letter arbitrary.

Examples
input
ab
a?a
2
aaa
aab
output
YES
NO

input
abc
a?a?a*
4
abacaba
abaca
apapa
aaaaax
output
NO
YES
NO
YES
Note
In the first example we can replace “?” with good letters “a” and “b”, so we can see that the answer for the first query is “YES”, and the answer for the second query is “NO”, because we can’t match the third letter.

Explanation of the second example.

The first query: “NO”, because character “*” can be replaced with a string of bad letters only, but the only way to match the query string is to replace it with the string “ba”, in which both letters are good.
The second query: “YES”, because characters “?” can be replaced with corresponding good letters, and character “*” can be replaced with empty string, and the strings will coincide.
The third query: “NO”, because characters “?” can’t be replaced with bad letters.
The fourth query: “YES”, because characters “?” can be replaced with good letters “a”, and character “*” can be replaced with a string of bad letters “x”.

在模板遇到’?’就替换好的字符,遇到”*” 就替换空或坏的字符串(不能有好的)

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<map>
using namespace std;
int main()
{
    string good, demo, str;
    int n, i, j, k;
    bool flag;
    map<char,bool>Map;
    cin >> good >> demo >> n;
    for(i = 0; good[i]; ++i){
        Map[good[i]] = true;
    }
    for(i = 0; i < n; ++i){
        cin >> str;
        int left1 = 0, right1 = demo.size(), left2 = 0, right2 = str.size();
        while((left1 < right1) && (left2 < right2) && ((demo[left1] == str[left2]) || (demo[left1] == '?' && Map[str[left2]]))){
            left1++; left2++;
        } 
        while(left1 < right1 && left2 < right2 && ((demo[right1-1] == str[right2-1]) || (demo[right1-1] == '?' && Map[str[right2-1]]))){
            right1--; right2--;
        }
        if(demo[left1] == '*'){
            while(left2 < right2 && Map[str[left2]] != true)
                left2++;
            left1++;
        }
        if(left1 == right1 && left2 == right2) printf("YES\n");
        else printf("NO\n");
    }
} 
《QGIS快速入门与应用基础》108:CGCS2000对应的投影坐标系 本文详细解析了CGCS2000地理坐标系对应的各类投影坐标系,包括高斯-克吕格3°带/6°带、UTM、地方独立投影和Web墨卡托投影。文章系统阐述了各投影类型的分带规则、参数设置、精度特性及适用场景,并提供了EPSG编码对照表和QGIS操作指南。通过"基准+投影"的绑定机制,这些投影坐标系实现了平面坐标与经纬度的精准转换,满足从大比例尺工程测量到Web地图服务等不同应用需求。内容涵盖投影原理、坐标格式、变形控制等关键技术要点,为GIS开发者和测绘人员提供了实用的参考信息。 阅读详情

相关推荐

NR RRC协议(2)---RRC连接建立流程

RRC连接建立目的是建立SRB1 RRC连接建立还用于将初始NAS消息从UE传送到网络 RRC连接的初始阶段期间,不激活AS安全性 RRC连接建立由UE侧发起

crg2046的博客 1964

深度剖析‘StringBuilder‘ can be replaced with ‘String‘ 提示

一、背景 在写代码的时候使用 StringBuilder 进行字符串拼接时,IDEA 很可能会给出下面的提示: ‘StringBuilder’ can be replaced with ‘String’ 。 那么为什么会给出这种提示?这种提示意味着什么? 二、思考 之前有讲过:“每一个疑问背后都隐藏着至少一个盲点和学习的绝佳机会”。因此我们不会轻易放过这个机会。 另外很多人这个时候可能就要开始百度了! 停!! “《阿里巴巴Java开发手册》详解” 专栏里有讲到“先猜想后验证”的思想,对学习源码等有很大帮助,

qq_34041723的博客 3305

学习笔记|多样本单因素方差分析|事后比较|方差齐性|F检验|韦尔奇检验|两独立样本T检验|两样本方差分析|规范表达|《小白爱上SPSS》课程:SPSS第七讲 | 单因素方差分析怎么做?

学习笔记|多样本单因素方差分析|事后比较|方差齐性|F检验|韦尔奇检验|两独立样本T检验|两样本方差分析|规范表达|《小白爱上SPSS》课程:SPSS第七讲 | 单因素方差分析怎么做?

Medlar_CN的博客 9527

java mongodb正则表达式错误

*?\java.*

badaofuliuying的博客 663

MAS1102量产工具实战指南:从下载到开卡,附固件选择与RDT优化技巧

本文提供MAS1102量产工具的实战指南,涵盖从工具下载、短接识别到开卡操作的全过程。重点解析了固件选择策略与RDT优化技巧,帮助用户成功修复基于联芸MAS1102主控的固态硬盘,解决常见开卡错误并提升SSD性能与稳定性。

c2d3e4f的博客 2281

从零搭建Obsidian智能知识库:Ollama本地模型与Copilot插件实战指南

本文详细介绍了如何从零搭建Obsidian智能知识库,结合Ollama本地模型与Copilot插件实现高效知识管理。通过本地部署AI助手,用户可以在保证隐私安全的同时,快速检索和整理笔记,提升工作效率。文章涵盖硬件准备、Ollama部署、插件配置及实战技巧,适合需要高效知识管理的专业人士。

weixin_29230773的博客 632

‘StringBuilder‘ can be replaced with ‘String‘

报告StringBuffer,StringBuilder或StringJoiner的所有用法,这些用法可以用单个java.lang.String串联代替。使用String连接可以使代码更短,更简单。例: StringBuilder result = new StringBuilder(); result.append("i = "); result.append(i); result.append(";"); return result.toString(); 该代码可以替换为 S

JavaEdge全是干货的技术号 4170

《Long-CLIP: Unlocking the Long-Text Capability of CLIP》

总的来说,Long-CLIP是一个改进的视觉-语言预训练模型,它通过知识保留的位置上插值和主要成分匹配策略,有效解决了原始CLIP模型在处理长文本输入时的限制。这一模型不仅在长文本图像检索任务中表现出色,而且在零样本图像分类任务中保持了与原始CLIP相当的性能,同时还能以即插即用的方式增强图像生成任务中的长文本处理能力。

Angelina_Jolie的博客 1384

B. Petya and Exam

B. Petya and Examtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIt's hard times now. Today Petya needs to score 100 points on Informatics exam. T...

dreamjay1997的博客 314

基于Pixi.js的Live2D看板娘离线加载实战指南

本文详细介绍了基于Pixi.js实现Live2D看板娘离线加载的完整方案,涵盖环境搭建、模型加载、交互功能实现及常见问题解决。通过Pixi.js的硬件加速优势,开发者可在Web和Electron项目中无缝集成离线运行的Live2D模型,提升用户体验并避免网络依赖问题。

weixin_29001423的博客 351

FPGA:UART串口接收(高干扰情况)

在上一篇文章中介绍过UART串口接收模块,其中一个需要优化的方向就是在高干扰情况下,如何实现可靠的UART串口接收任务。

weixin_50164178的博客 1678

Codeforces Round #425 (Div. 2)

Codeforces Round #425 (Div. 2)   补完题才发现自己真的失了智,好久没打CF,竟然又是死在小细节上。错过多少次涨分良机。                                                             A. Sasha and Sticks   水题,求n/k的奇偶

NYIST_TC_LYQ的博客 494

AI快速变现之路,AI视频创作

初期投入$3000(工具订阅+样片制作),重点攻克跨境电商和本地生活服务市场。关注2025年AIGC视频工具的API降价趋势(如Pika企业版折扣可达50%),建议与云服务商签订长期合作协议。

qq_29896351的博客 1987

Codeforces Round #243 425B 425D

十分有趣的两道题目,425D据说是

jasison 889

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

Codeforces Round #425 B

题目链接:http://codeforces.com/contest/832/problem/B题意: 首行给你一些小写字母,good character 第二行给你一段A字符串,含有小写字母 ? * ?只能匹配一个good character * 匹配空串和一段非good character 再给你n个字符串,问各个字符串是否能和A串匹配题解: 按照题意模拟就好,*可以匹配字符或字符

CatDsy的博客 472

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

Codeforces Round #425

A. Sasha and Sticks time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output It's one more school day now. Sasha doesn't like

cxy666 297

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

#425[div2]

A 签到 1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 int main(){ 5 ll n,k; 6 cin>>n>>k; 7 ll ans=n/k; 8 if(ans%2==1){ ...

weixin_30865427的博客 67

Codeforces #425 Div2 D

#425 Div2 D 题意 给出一个树形图,每次询问给出三个点,从其中选择两个作为起始点,一个终点,求从两个起始点出发(走最短路)到达终点经过的共同的点最多的数量。 分析 这种树上点与点之间距离有关的问题大多与 LCA 有关,那么我暴力枚举每个点分别作为起始点、终点,求下最大距离就好了。 code #include<bits/stdc++.h> using namespace std...

weixin_34128237的博客 93

Codeforces Round #425 A

Sasha and Sticks 题意:n根棍子,每次拿走k根,当不足k根的时候不能拿,输,判断先手能否赢 思路:(n/k)&1,直接判断能经行奇数次取木棍还是偶数 AC代码: #include "iostream" #include "string.h" #include "stack" #include "queue" #include "string" #inc...

weixin_30505751的博客 83

Codeforces Round #425 Div. 2

A题 分析:直接看n/k的奇偶性 1 #include "iostream" 2 #include "cstdio" 3 #include "cstring" 4 using namespace std; 5 long long n,k; 6 int main() 7 { 8 cin>>n>>k; 9 long ...

weixin_30394333的博客 109

Codefoces Round #425 Div.2小结

Codefoces Round #425 Div.2小结

废窝 436
上一篇: #424
Code_Diary
博客等级 码龄10年 3粉丝 30原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址