1. #include <iostream>
  2. #include <cstdio>
  3. #include <string.h>
  4. #include <algorithm>
  5.  
  6. using namespace std;
  7. /*
  8. 水题,注意字符范围是整个ASCII编码即可。
  9. */
  10. const int maxn=;
  11. int vis[maxn];
  12. char s1[+];
  13. char s2[+];
  14.  
  15. int main()
  16. {
  17. gets(s1);
  18. //getchar();
  19. gets(s2);
  20. int len1=strlen(s1);
  21. int len2=strlen(s2);
  22. for(int i=;i<len2;i++){
  23. //printf("s2 %c %d\n",s2[i],s2[i]-'0'+48);
  24. vis[s2[i]-''+]=;
  25. }
  26. char res[+];
  27. int cnt=;
  28. for(int i=;i<len1;i++){
  29. if(!vis[s1[i]-''+]){
  30. //printf("s1 %c %d\n",s1[i],s1[i]-'0'+48);
  31. res[cnt]=s1[i];
  32. cnt++;
  33. }
  34. }
  35. res[cnt]='\0';
  36. printf("%s\n",res);
  37. return ;
  38. }

PAT甲题题解-1050. String Subtraction (20)-水题的更多相关文章

  1. PAT甲题题解-1041. Be Unique (20)-水题

    博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6789189.html特别不喜欢那些随便转载别人的原创文章又不给 ...

  2. PAT甲题题解-1120. Friend Numbers (20)-水题

    博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6789775.html特别不喜欢那些随便转载别人的原创文章又不给 ...

  3. PAT 解题报告 1050. String Subtraction (20)

    1050. String Subtraction (20) Given two strings S1 and S2, S = S1 - S2 is defined to be the remainin ...

  4. PAT 甲级 1050 String Subtraction (20 分) (简单送分,getline(cin,s)的使用)

    1050 String Subtraction (20 分)   Given two strings S​1​​ and S​2​​, S=S​1​​−S​2​​ is defined to be t ...

  5. PAT (Advanced Level) 1050. String Subtraction (20)

    简单题. #include<iostream> #include<cstring> #include<cmath> #include<algorithm> ...

  6. PAT练习--1050 String Subtraction (20 分)

    题⽬⼤意:给出两个字符串,在第⼀个字符串中删除第⼆个字符串中出现过的所有字符并输出. 这道题的思路:将哈希表里关于字符串s2的所有字符都置为true,再对s1的每个字符进行判断,若Hash[s1[i] ...

  7. PAT Advanced 1050 String Subtraction (20 分)

    Given two strings S​1​​ and S​2​​, S=S​1​​−S​2​​ is defined to be the remaining string after taking ...

  8. 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 ...

  9. 【PAT甲级】1050 String Subtraction (20 分)

    题意: 输入两个串,长度小于10000,输出第一个串去掉第二个串含有的字符的余串. trick: ascii码为0的是NULL,减去'0','a','A',均会导致可能减成负数. AAAAAccept ...

随机推荐

  1. 使用 jekyll + github pages 搭建个人博客

    1. 新建 github.io 项目 其实 github pages 有两个用途,大家可以在官方网页看到.其中一个是作为个人/组织的主页(每个账号只能有一个),另一个是作为 github 项目的项目主 ...

  2. 内网DHCP攻击

    局域网内DHCP攻击 实验环境:两个win2008 r2虚拟机(一台用作正常的DHCP服务器,另一台用作伪造DHCP服务器),两个win7虚拟机(用作客户机),一个kali虚拟机(用作攻击,耗尽DHC ...

  3. windows最常用的快捷键(windows10 )

    windows最常用的快捷键(windows10 ) [单指点击] 单击/双击,相当于鼠标左键. [单指滑动] 控制光标移动. [单指拖动] 相当于按下鼠标左键移动鼠标. [双指点击] 菜单键,相当于 ...

  4. 题解 P1034 【矩形覆盖】

    题面 在平面上有n个点(n≤50),每个点用一对整数坐标表示.例如:当n=4时,4个点的坐标分另为:p1(1,1),p2(2,2),p3(3,6),P4(0,7),见图一. 这些点可以用k个矩形(1≤ ...

  5. Spring的InitializingBean与DisposableBean方法

    在bean初始化的时候,将所有显示提供的属性设置完毕后调用这个方法 org.springframework.beans.factory.InitializingBean#afterProperties ...

  6. 漫画:什么是HashMap?

    漫画系列摘抄自程序员小灰的博客https://blog.csdn.net/bjweimengshu/article/list/3?t=1 ------------------------------- ...

  7. 理解传说中的roll、yaw、pitch

    三维中 Yaw, pitch and roll 的区分(图片)                    yaw 航偏                                         pi ...

  8. WorldWind源码剖析系列:表面影像类SurfaceImage

    表面影像类SurfaceImage描述星球类(如地球)表面纹理影像.该类的类图如下. 表面影像类SurfaceImage包含的主要的字段.属性和方法如下: string m_ImageFilePath ...

  9. leetcode16—3 Sum Closet

    Given an array nums of n integers and an integer target, find three integers in nums such that the s ...

  10. JS输入框邮箱自动提示(带有demo和源码)

    今天在javascriptQQ群里面 有童鞋问到 有没有 "JS输入框邮箱自动提示"插件,即说都找遍了github上源码 都没有看到这样类似的插件,然后我想了下 "JS输 ...