题意:

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

trick:

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

AAAAAccepted code:

 #define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
char s1[],s2[];
int vis[];
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin.getline(s1,);
cin.getline(s2,);
int n=strlen(s1);
int m=strlen(s2);
for(int i=;i<m;++i)
vis[s2[i]-NULL]=;
for(int i=;i<n;++i)
if(!vis[s1[i]-NULL])
cout<<s1[i];
return ;
}

【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. SRAM速度提升思路及方法

    SRAM总体分为两大部分,一部分是存储阵列,另一部分是外围辅助电路.提高SRAM工作速度从这两大方面着手. ·存储阵列 对于存储阵列,首先可以通过降低工艺节点,以达到提高器件本身速度,从而提高整体SR ...

  2. Bugku - Misc图穷匕见 - Writeup

    Bugku - Misc图穷匕见 - Writeup 原文链接:http://www.cnblogs.com/WangAoBo/p/6950547.html 题目 给了一个jpg图片,下载图片 分析 ...

  3. Flask 教程 第十五章:优化应用结构

    本文翻译自The Flask Mega-Tutorial Part XV: A Better Application Structure 这是Flask Mega-Tutorial系列的第十五部分,我 ...

  4. js中map和filter方法,以及search方法

    链接:https://blog.51cto.com/11871779/2126561 search方法: 介绍: search() 方法用于检索字符串中指定的子字符串,或检索与正则表达式相匹配的子字符 ...

  5. Docker - 周边 - Go Template

    概述 docker inspect -f 引出 希望学会后, 可以处理这个命令 问题: 这是啥 疑问 最开始, 我以为是 jsonpath 后来看 命令行的解释, 说叫 go template 但是我 ...

  6. plus.webview.create( url, id, styles, extras )参数及说明

    plus.webview.create( "xxx.html", //url:String类型,可选,新窗口加载的HTML页面地址.新打开Webview窗口要加载的HTML页面地址 ...

  7. 金中宝POS

    金中宝POS机刷卡到账时间:9:00-22:00 现代金控自选商户POS机注意事项 选择: 1 消费 T+1到账(下一个工作日到账) 选择: 2 订单支付 是实时到账! 一.金中宝POS机秒到时间:2 ...

  8. c# 泛型demo

    private void Fn_Post<T>(T dto, string api) { HttpClient client = new HttpClient(); client.Base ...

  9. Hadoop架构: HDFS中数据块的状态及其切换过程,GS与BGS

    该系列总览: Hadoop3.1.1架构体系——设计原理阐述与Client源码图文详解 : 总览 首先,我们要提出HDFS存储特点: 1.高容错 2.一个文件被切成块(新版本默认128MB一个块)在不 ...

  10. 5.Python语句

    .button, #logout { color: #333; background-color: #fff; border-color: #ccc; } span#login_widget > ...