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 ...
随机推荐
- 1.Redis安装(Linux环境)
转载请出自出处:http://www.cnblogs.com/hd3013779515/ 1.Redis安装 使用的最新版本为 3.2.9,下载并安装: wget http://download.re ...
- Angular开发环境搭建和项目创建以及启动
工具的安装 首先需要安装node,直接在官网下载node,然后一直下一步安装完即可,在安装node的时候自带了npm包管理工具 然后安装Angular CLI,使用npm命令安装输入以下命令 npm ...
- import org.apache.http.xxxxxx 爆红,包不存在之解决办法
问题如下:import org.apache.http.HttpResponse;import org.apache.http.NameValuePair;import org.apache.http ...
- linux 的常用命令---------第七阶段
LVM 逻辑卷管理器 -----其作用为 :在线扩容 卷组 vG (也叫LVM卷组) ------------------→ 在此卷组vG上建立 : 逻辑卷组 LV ( ...
- oracle11g dataguard 备库数据同步的检查方法
概述: 一.环境 主库: ip地址:192.168.122.203 oracle根目录:/data/db/oracle SID:qyq 数据文 ...
- oracle偏爱hostname
记住: 只要是在使用oracle他家的产品,比如oracle database , weblogic :或者诸如此类,等等,等等,随便别的什么东西 首先要查改: /etc/hosts 127.0.0. ...
- jmeter测试webservice接口
webservice怎样使用jmeter测试呢? 测试样例url=http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx ...
- leetcode322—Coin Change
You are given coins of different denominations and a total amount of money amount. Write a function ...
- Vue复选框的全选
<!DOCTYPE html><html> <head> <meta charset="utf-8"> ...
- Arduino入门笔记(9):蓝牙模块及第一辆蓝牙遥控小车
转载请注明:@小五义 http://www.cnblogs.com/xiaowuyi 欢迎加入讨论群 64770604 一.本次实验所需器材 1.Arduino UNO板 https://item.t ...