PAT甲题题解-1050. String Subtraction (20)-水题
#include <iostream>
#include <cstdio>
#include <string.h>
#include <algorithm> using namespace std;
/*
水题,注意字符范围是整个ASCII编码即可。
*/
const int maxn=;
int vis[maxn];
char s1[+];
char s2[+]; int main()
{
gets(s1);
//getchar();
gets(s2);
int len1=strlen(s1);
int len2=strlen(s2);
for(int i=;i<len2;i++){
//printf("s2 %c %d\n",s2[i],s2[i]-'0'+48);
vis[s2[i]-''+]=;
}
char res[+];
int cnt=;
for(int i=;i<len1;i++){
if(!vis[s1[i]-''+]){
//printf("s1 %c %d\n",s1[i],s1[i]-'0'+48);
res[cnt]=s1[i];
cnt++;
}
}
res[cnt]='\0';
printf("%s\n",res);
return ;
}
PAT甲题题解-1050. String Subtraction (20)-水题的更多相关文章
- PAT甲题题解-1041. Be Unique (20)-水题
博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6789189.html特别不喜欢那些随便转载别人的原创文章又不给 ...
- PAT甲题题解-1120. Friend Numbers (20)-水题
博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6789775.html特别不喜欢那些随便转载别人的原创文章又不给 ...
- PAT 解题报告 1050. String Subtraction (20)
1050. String Subtraction (20) Given two strings S1 and S2, S = S1 - S2 is defined to be the remainin ...
- PAT 甲级 1050 String Subtraction (20 分) (简单送分,getline(cin,s)的使用)
1050 String Subtraction (20 分) Given two strings S1 and S2, S=S1−S2 is defined to be t ...
- PAT (Advanced Level) 1050. String Subtraction (20)
简单题. #include<iostream> #include<cstring> #include<cmath> #include<algorithm> ...
- PAT练习--1050 String Subtraction (20 分)
题⽬⼤意:给出两个字符串,在第⼀个字符串中删除第⼆个字符串中出现过的所有字符并输出. 这道题的思路:将哈希表里关于字符串s2的所有字符都置为true,再对s1的每个字符进行判断,若Hash[s1[i] ...
- PAT Advanced 1050 String Subtraction (20 分)
Given two strings S1 and S2, S=S1−S2 is defined to be the remaining string after taking ...
- PAT Advanced 1050 String Subtraction (20) [Hash散列]
题目 Given two strings S1 and S2, S = S1 – S2 is defined to be the remaining string afer taking all th ...
- 【PAT甲级】1050 String Subtraction (20 分)
题意: 输入两个串,长度小于10000,输出第一个串去掉第二个串含有的字符的余串. trick: ascii码为0的是NULL,减去'0','a','A',均会导致可能减成负数. AAAAAccept ...
随机推荐
- DevExpress12、DocumentManager
DocumentManager控件 你用过Photoshop吗?里面每打开一个照片,就有一个小窗体承载这个照片,你可以在这些小窗体间切换,最小化.最大化.排列窗体, 这些操作都在Photoshop的大 ...
- 【Ansible 文档】【译文】Windows 支持
see also:List of Windows Modules Windows Support Windows 支持 Windows: How Does It Work Windows:如何工作 正 ...
- QT5 视图坐标
又出错了. . main.obj:-1: error: LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __th ...
- scrapy的request的meta参数是什么意思?
作者:乌尔班链接:https://www.zhihu.com/question/54773510/answer/146971644来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注 ...
- docker构建Java环境
FROM java:7 COPY . /usr/src/javaapp WORKDIR /usr/src/javaapp RUN javac HelloWorld.java CMD ["ja ...
- [转]OpenGL通过VBO实现顶点数组绘制顶点
#include "stdlib.h" #include <OpenGL/glext.h> #include <GLUT/GLUT.h> #define B ...
- OpenCV 中轮廓包裹的几个函数boundingRect、minAreaRect、minEnclosingCircle用法
当我们得到对象轮廓后,可用boundingRect()得到包覆此轮廓的最小正矩形,minAreaRect()得到包覆轮廓的最小斜矩形,minEnclosingCircle()得到包覆此轮廓的最小圆形, ...
- JAVA框架Struts2 servlet API
一:servlet API 1)完全解耦接口: 使用ActionContext类进行相关操作: package jd.com.actioncontex; import com.opensymphony ...
- # 2017-2018-2 20155319『网络对抗技术』Exp6:信息收集与漏洞扫描
2017-2018-2 20155319『网络对抗技术』Exp6:信息收集与漏洞扫描 实践内容 (1)各种搜索技巧的应用 (2)DNS IP注册信息的查询 (3)基本的扫描技术:主机发现.端口扫描.O ...
- 路遥眼里的河南人<平凡的世界>
路遥,一个作过农民,当过小学教师,用平凡的生命,却写出不平凡的小说<平凡的世界>,他喜欢夜的宁静,喜欢在夜里思考,他说只有在夜里我们才是最真实的自己.所以他喜欢在夜里创作,这部小说也是在这 ...