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 ...
随机推荐
- 使用 jekyll + github pages 搭建个人博客
1. 新建 github.io 项目 其实 github pages 有两个用途,大家可以在官方网页看到.其中一个是作为个人/组织的主页(每个账号只能有一个),另一个是作为 github 项目的项目主 ...
- 内网DHCP攻击
局域网内DHCP攻击 实验环境:两个win2008 r2虚拟机(一台用作正常的DHCP服务器,另一台用作伪造DHCP服务器),两个win7虚拟机(用作客户机),一个kali虚拟机(用作攻击,耗尽DHC ...
- windows最常用的快捷键(windows10 )
windows最常用的快捷键(windows10 ) [单指点击] 单击/双击,相当于鼠标左键. [单指滑动] 控制光标移动. [单指拖动] 相当于按下鼠标左键移动鼠标. [双指点击] 菜单键,相当于 ...
- 题解 P1034 【矩形覆盖】
题面 在平面上有n个点(n≤50),每个点用一对整数坐标表示.例如:当n=4时,4个点的坐标分另为:p1(1,1),p2(2,2),p3(3,6),P4(0,7),见图一. 这些点可以用k个矩形(1≤ ...
- Spring的InitializingBean与DisposableBean方法
在bean初始化的时候,将所有显示提供的属性设置完毕后调用这个方法 org.springframework.beans.factory.InitializingBean#afterProperties ...
- 漫画:什么是HashMap?
漫画系列摘抄自程序员小灰的博客https://blog.csdn.net/bjweimengshu/article/list/3?t=1 ------------------------------- ...
- 理解传说中的roll、yaw、pitch
三维中 Yaw, pitch and roll 的区分(图片) yaw 航偏 pi ...
- WorldWind源码剖析系列:表面影像类SurfaceImage
表面影像类SurfaceImage描述星球类(如地球)表面纹理影像.该类的类图如下. 表面影像类SurfaceImage包含的主要的字段.属性和方法如下: string m_ImageFilePath ...
- leetcode16—3 Sum Closet
Given an array nums of n integers and an integer target, find three integers in nums such that the s ...
- JS输入框邮箱自动提示(带有demo和源码)
今天在javascriptQQ群里面 有童鞋问到 有没有 "JS输入框邮箱自动提示"插件,即说都找遍了github上源码 都没有看到这样类似的插件,然后我想了下 "JS输 ...