题意:

输入两个串,长度小于10000,输出第一个串去掉第二个串含有的字符的余串。

trick:

ascii码为0的是NULL,减去'0','a','A',均会导致可能减成负数。

AAAAAccepted code:

  1. #define HAVE_STRUCT_TIMESPEC
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4. char s1[],s2[];
  5. int vis[];
  6. int main(){
  7. ios::sync_with_stdio(false);
  8. cin.tie(NULL);
  9. cout.tie(NULL);
  10. cin.getline(s1,);
  11. cin.getline(s2,);
  12. int n=strlen(s1);
  13. int m=strlen(s2);
  14. for(int i=;i<m;++i)
  15. vis[s2[i]-NULL]=;
  16. for(int i=;i<n;++i)
  17. if(!vis[s1[i]-NULL])
  18. cout<<s1[i];
  19. return ;
  20. }

【PAT甲级】1050 String Subtraction (20 分)的更多相关文章

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

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

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

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

  4. PAT甲级——1050 String Subtraction

    1050 String Subtraction Given two strings S​1​​ and S​2​​, S=S​1​​−S​2​​ is defined to be the remain ...

  5. PAT 甲级 1050 String Subtraction

    https://pintia.cn/problem-sets/994805342720868352/problems/994805429018673152 Given two strings S~1~ ...

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

  7. 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 解题报告 1050. String Subtraction (20)

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

  9. PAT 甲级 1035 Password (20 分)

    1035 Password (20 分) To prepare for PAT, the judge sometimes has to generate random passwords for th ...

随机推荐

  1. xshell配置---文件上传命令rz和下载命令sz

    1.下载安装包 方法一:手动下载安装 1)下载安装包:lrzsz-0.12.20.tar.gz 官网下载地址:http://www.ohse.de/uwe/releases/lrzsz-0.12.20 ...

  2. 95. 不同的二叉搜索树 II、96. 不同的二叉搜索树

    95 Tg:递归 这题不能算DP吧,就是递归 一个问题:每次的树都要新建,不能共用一个根节点,否则下次遍历对根左右子树的改动会把已经放进结果数组中的树改掉.. class Solution: def ...

  3. es7实现数学乘方

    //math.pow简写方法 console.log(2 ** 6)

  4. 吴裕雄 python 机器学习——数据预处理标准化MinMaxScaler模型

    from sklearn.preprocessing import MinMaxScaler #数据预处理标准化MinMaxScaler模型 def test_MinMaxScaler(): X=[[ ...

  5. mac登录窗口出现白框问题解决

    昨天早上起床打开电脑,发现登录窗口的界面出现了大半边的白框,如下图,可是昨晚上关机前还是好好的,而且新电脑不至于啥也没干屏幕就出问题. 输入密码进入桌面,OK,不是屏幕的问题,那为什么会出现白框呢? ...

  6. cube-ui IndexList 切换Tab Y坐标归零

    <template> <div class="fx t12 column"> <div class="order_search_div fl ...

  7. shell脚本入门笔记

    转载:http://mp.weixin.qq.com/s?__biz=MzA3MTIxNzkyNg==&mid=204081791&idx=1&sn=27bb1d827e0f8 ...

  8. AT24C02芯片学习记录

    1.首先看AT24C02芯片的引脚说明 2.芯片的型号与存储容量(bit)的对应关系: 3.总线时序 我对时序的理解: 时钟线分两种:一种是外部时钟源控制时钟线低电平持续多久高电平持续多久,就像串口: ...

  9. opencv python:直线检测 与 圆检测

    霍夫直线变换介绍 霍夫圆检测 现实中: example import cv2 as cv import numpy as np # 关于霍夫变换的相关知识可以看看这个博客:https://blog.c ...

  10. Bugku-CTF加密篇之凯撒部长的奖励(就在8月,超师傅出色地完成了上级的特遣任务,凯撒部长准备给超师傅一份特殊的奖励.......)

    凯撒部长的奖励 就在8月,超师傅出色地完成了上级的特遣任务,凯撒部长准备给超师傅一份特殊的奖励,兴高采烈的超师傅却只收到一长串莫名的密文,超师傅看到英语字串便满脸黑线,帮他拿到这份价值不菲的奖励吧. ...