【PAT甲级】1050 String Subtraction (20 分)
题意:
输入两个串,长度小于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 分)的更多相关文章
- 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 1050 String Subtraction (20 分)
Given two strings S1 and S2, S=S1−S2 is defined to be the remaining string after taking ...
- PAT练习--1050 String Subtraction (20 分)
题⽬⼤意:给出两个字符串,在第⼀个字符串中删除第⼆个字符串中出现过的所有字符并输出. 这道题的思路:将哈希表里关于字符串s2的所有字符都置为true,再对s1的每个字符进行判断,若Hash[s1[i] ...
- PAT甲级——1050 String Subtraction
1050 String Subtraction Given two strings S1 and S2, S=S1−S2 is defined to be the remain ...
- PAT 甲级 1050 String Subtraction
https://pintia.cn/problem-sets/994805342720868352/problems/994805429018673152 Given two strings S~1~ ...
- 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 ...
- 1050 String Subtraction (20分)
Given two strings S1 and S2, S=S1−S2 is defined to be the remaining string after taking ...
- 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 甲级 1035 Password (20 分)
1035 Password (20 分) To prepare for PAT, the judge sometimes has to generate random passwords for th ...
随机推荐
- redis 解决秒杀
# import redis pool = redis.ConnectionPool(host = '127.0.0.1', port=6379, db=0)#创建连接池 r = redis.Redi ...
- C语言合法标识符 题解
输入一个字符串,判断其是否是C的合法标识符. Input输入数据包含多个测试实例,数据的第一行是一个整数n,表示测试实例的个数,然后是n行输入数据,每行是一个长度不超过50的字符串. Output对 ...
- idea中运行ssm 或springboot项目时,project Structure的配置
ctrl+alt+shift+s进入 project Structure 首先是project选项 Modules 标明source testsource 以及 resource 和 testreso ...
- 【转载】Java集合容器全面分析
转自:http://blog.csdn.net/garfielder007/article/details/52143803 简介: 集合类Collection不是Java的核心类,是Java的扩展类 ...
- Form DataGridView绑定BindingSource的几种方式
本文链接:https://blog.csdn.net/qq_15138169/article/details/83341076 在WinForm的开发中,ListView和DataGridView应用 ...
- 计算几何-多边形内核判定-HPI-poj3335
This article is made by Jason-Cow.Welcome to reprint.But please post the article's address. 先解决一个问题, ...
- Python 特殊列表操作记录
1.列表中的NaN数据处理 由于在Excel中筛选数据时,会出现NaN这种数据,所以需要将其删除掉,处理函数如下: 由于NaN数据类型与其他数据类型不一样,所以需要需要根据类型将其去除掉. 2列表关于 ...
- 前端——语言——Core JS——《The good part》读书笔记——附录三,四,五(JSLint,铁路图,JSON)
1.JSLint 本书的JSLint部分只是一个引言,详细了解该工具的使用参考http://www.jslint.com/ 2.铁路图 在本书中使用过的铁路图集中放在这部分附录中,其实读完本书之后,没 ...
- 粪发涂墙-Redis
Redis的高并发和快速原因 1.redis是基于内存的,内存的读写速度非常快: 2.redis是单线程的,省去了很多上下文切换线程的时间: 3.redis使用多路复用技术,可以处理并发的连接.非阻塞 ...
- 在Linux系统下安装nginx教程
最近学习了nginx,就打算nginx安装在Linux系统下,于是我就把安装步骤记录下来了,分享给大家,希望能对大家有帮助! 我的博客地址:https://www.cnblogs.com/themys ...