Codeforces832B Petya and Exam
来源:互联网 发布:mac怎么更改用户名称 编辑:程序博客网 时间:2024/05/23 16:48
——————————————————————————————————
题目的意思是先给出一个字符串表示好字母,'?'可以表示任何好字母,'*'表示任何不好字母的串,问每次查询是否更由原字符串得到
思路:因为只有一个‘*’,直接判
#include <iostream>#include <cstdio>#include <cstring>#include <string>#include <algorithm>#include <cmath>#include <map>#include <set>#include <stack>#include <queue>#include <vector>#include <bitset>using namespace std;#define LL long long#define mem(a,b) memset(a,b,sizeof a)const int INF = 0x3f3f3f3f;#define MAXN 100100#define MAXM 1000100char a[100005];char b[100005];int fl[1000];int main(){ int n; while(~scanf("%s",a)) { mem(fl,0); int k1=strlen(a); for(int i=0; i<k1; i++) fl[a[i]]=1; scanf("%s",a); k1=strlen(a); scanf("%d",&n); while(n--) { scanf("%s",b); int k2=strlen(b); int flag=0; int i=0,j=0; while(j<k2) { if(a[i]=='*') { for(int q=0; q<k2-k1+1; q++) { if(fl[b[j]]==1) { flag=1; break; } j++; } i++; continue; } if(j>=k2) break; i++,j++; if((a[i-1]=='?'&&fl[b[j-1]]==1)||a[i-1]==b[j-1]) continue; flag=1; if(flag) break; } if(i<k1&&(k1-k2>1||a[k1-1]!='*')) flag=1; if(flag) printf("NO\n"); else printf("YES\n"); } } return 0;}
阅读全文
0 0
- Codeforces832B Petya and Exam
- Petya and Exam
- cfRound425B. Petya and Exam
- B. Petya and Exam
- B. Petya and Exam【字符串】
- cf Petya and Exam(暴力)
- B. Petya and Exam(思维)
- CodeForces 832B Petya and Exam
- codeforces B. Petya and Exam (模拟)
- cf 832B Petya and Exam
- codeforces 832B (Petya and Exam)
- CodeForces 832 B. Petya and Exam
- CodeForces-832B Petya and Exam
- Petya and Exam(Codeforces Round #425 (Div. 2))
- Codeforces Round #425 (Div. 2)B. Petya and Exam
- CodeFroces 823B. Petya and Exam(构造题)
- Codeforces Round #425 (Div. 2) B. Petya and Exam
- codeforces 832B ——Petya and Exam
- Android Bitmap操作内存问题总结(图片处理、截屏等)
- AndroidStudio运行项目出现This version of Android Studio is incompatible with the Gradle Plugin used.
- Mac终端Iterm2快捷键大全
- 初识springboot
- 看看安东尼詹姆斯
- Codeforces832B Petya and Exam
- Android之调用系统分享
- Spring4.3x教程之二SpEL表达式的使用
- A
- camder的安装及设置
- 利用R语言画出两地路线图
- nginx日志
- LinkedList、ArrayList和Vector的区别
- spring集成mybatis,dbcp连接池的配置文件